import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class FlightSearchService {

  constructor(private http: HttpClient) { }

  searchFlights(airportOriginId: number, airportDestinationId: number, departureDate: string): Observable<any[]> {
    return this.http.get<any[]>(`http://localhost:9077/AVB/service/reservations/flights/search?airportOriginId=${airportOriginId}&airportDestinationId=${airportDestinationId}&departureDate=${departureDate}`);
  }
}
