import { Component, Input } from '@angular/core';
import { IStation, Transfer } from '@app/shared/models-legacy';

@Component({
    selector: 'transfer-section',
    templateUrl: './transfer-section.component.html',
    styleUrls: ['./transfer-section.component.scss'],
})
export class TransferSectionComponent {
    @Input() transfer: Transfer;
    @Input() hideDeparture = false;

    get firstCity() {
        return this.transfer.stationChange === 'city'
            ? this.getCity(this.transfer.arrival)
            : this.getCity(this.transfer.departure);
    }

    get secondCity() {
        return this.getCity(this.transfer.departure);
    }

    getCity(station: IStation) {
        return station.latest ? station.latest.city : station.scheduled.city;
    }
}
