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

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

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

    get flightInfo() {
        const { flightNumber, carrier } = this.request;
        return `${carrier}\u00a0${flightNumber}`;
    }
}
