import { Component, EventEmitter, Input, Output } from '@angular/core';
import { IPopularRouteRequest } from '@typings/popular-request';
import { RequestMode } from '@typings/enums';

@Component({
    selector: 'route-request',
    templateUrl: './route-request.component.html',
})
export class RouteRequestComponent {
    @Input() request: IPopularRouteRequest;
    @Output() onClick = new EventEmitter<IPopularRouteRequest>();

    onRequestInfoClick() {
        this.onClick.emit(this.request);
    }

    get label() {
        switch (this.request.mode) {
            case RequestMode.ROUTE: {
                return this.request.type === 'Onlineboard'
                    ? 'BOARD.ROUTE'
                    : 'SCHEDULE.SCHEDULE-OUTBOUND';
            }
            case RequestMode.SCHEDULE_ROUTE_BOTH_DIRECTIONS: {
                return 'SCHEDULE.SCHEDULE-FULL-ROUTE';
            }
        }
    }
}
