import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Leg, MultiLegFlight } from '@shared/models-legacy';
import { IFlight } from '@typings/flight/flight';

@Component({
    selector: 'multi-flight-body',
    templateUrl: './multi-flight-body.component.html',
})
export class ScheduleSearchResultMultiFlightBodyComponent {
    @Input() flight: MultiLegFlight;
    @Output() toDetails = new EventEmitter<IFlight>();

    handleToDetailsEvent(flight: IFlight) {
        this.toDetails.emit(flight);
    }

    get legs(): Leg[] {
        return this.flight.legs;
    }
}
