import {
    IFlightArrivalStationTimes,
    IFlightDepartureStationTimes,
} from '@typings/flight/flight-station';

export function departureBlockOffTimes(times: IFlightDepartureStationTimes) {
    const { actualBlockOff, estimatedBlockOff } = times;

    return actualBlockOff ? actualBlockOff : estimatedBlockOff;
}

export function departureBlockOffCaption(times: IFlightDepartureStationTimes) {
    return times.actualBlockOff ? 'SHARED.ACTUAL' : 'SHARED.EXPECTED';
}

export function arrivalBlockOnTimes(times: IFlightArrivalStationTimes) {
    const { actualBlockOn, estimatedBlockOn } = times;

    return actualBlockOn ? actualBlockOn : estimatedBlockOn;
}

export function arrivalBlockOnCaption(times: IFlightArrivalStationTimes) {
    return times.actualBlockOn ? 'SHARED.ACTUAL' : 'SHARED.EXPECTED';
}
