import { getSearchParam } from '../../helpers/SearchParams';
import { IFlight } from '../Dashboard/CustomerDashboard';


export interface IBookingList {
  flights: IFlight[]
}


export async function GetBookingList({ request }: { request: Request}): Promise<IBookingList> {
  const origin = getSearchParam(request.url, 'origin');
  const destination = getSearchParam(request.url, 'destination');
  const date = getSearchParam(request.url, 'date');
  const seatType = getSearchParam(request.url, 'seatType');

  console.log('ready to call API with:', origin, destination, date, seatType);

  return {
    flights: [
      {
        id: 11,
        flightNumber: '0011',
        flightPath: 'LTN - MLG',
        flightPathFull: 'London(LTN) - Spain(MLG)',
        economyPrice: 50,
        businessPrice: 100,
        departureTime: '10/8/2024 11:00:00 AM',
        arrivalTime: '10/8/2024 13:00:00 PM'
      },
      {
        id: 12,
        flightNumber: '0012',
        flightPath: 'LTN - MLG',
        flightPathFull: 'London(LTN) - Spain(MLG)',
        economyPrice: 50,
        businessPrice: 100,
        departureTime: '11/8/2024 11:00:00 AM',
        arrivalTime: '11/8/2024 13:00:00 PM'
      },
    ]
  };
}