import { Pipe, PipeTransform } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { Transfer } from '../models-legacy';

@Pipe({
    name: 'stationChange',
})
export class StationChangePipe implements PipeTransform {
    constructor(private translate: TranslatePipe) {}
    transform(transfer: Transfer): string {
        if (!transfer?.stationChange || transfer.stationChange === 'noChange') {
            return '';
        }

        switch (transfer.stationChange) {
            case 'city': {
                return this.translate.transform('SHARED.CITY_CHANGE');
            }
            case 'airport': {
                return this.translate.transform('SHARED.AIRPORT_CHANGE');
            }
            case 'terminal': {
                return this.translate.transform('SHARED.TERMINAL_CHANGE');
            }
        }
    }
}
