import { FlightLoadedState } from '../enumerators';
import { IFlightId } from './flight-id.model';
import { Leg } from './leg.model';
import { IOperatingByLegacy } from './operator.model';
import { RouteModel } from './route.model';

export interface FlightModel extends RouteModel {
    operatingBy: IOperatingByLegacy;
    flightId: IFlightId;
    dateToSearchBy: Date;
    id: string;
    boardings: number;
    isMultiFlight: boolean; // aka Connected
    isMultiLeg: boolean; // aka Multi-Segment, Multi-Leg
    hash: string;
    previous: FlightModel;
    next: FlightModel;
    loadedState: FlightLoadedState;
    lastUpdate: Date;
    flights?: FlightModel[];
    leg: Leg;
    legs: Leg[];
}

export interface DirectFlight extends FlightModel {
    leg: Leg;
}

export interface MultiLegFlight extends FlightModel {
    legs: Leg[];
}

export interface ConnectingFlight extends FlightModel {
    flights: FlightModel[];
}

export type AnyOfFlightModel = DirectFlight | MultiLegFlight | ConnectingFlight;

export type ListItem<T> = T & { expanded?: boolean; visible?: boolean };
