import { LoginPage } from '@admin-lib/login';
import { FlightTripType, FlightInterceptApis } from '@flight-lib/index';
import { FlightBookingUtility, FlightUtility } from '@flight-modal/index';
import { Provider_Type, User_Type } from '@support-onboard/index';
import { LocationUtility } from '@utility-lib/index';

describe('Flight: booking with insurance', () => {
  it('C5845525: Should able to book flight with insurance', { tags: ['@tier2'] }, () => {
    FlightInterceptApis.interceptFlightsApis();
    LoginPage.createNewCompanyAndLoginWithUserByType({
      providers: [Provider_Type.MOCK_FLIGHT],
      users: [User_Type.ADMIN],
      companySuffix: '-insurance'
    });

    const flightBookingParams = FlightBookingUtility.initFlightBookingParams({
      locations: LocationUtility.getAirportsIndiaAsOriginAndUSAsDestination(),
      flightTripType: FlightTripType.ONEWAY,
      tripTileType: 'Business',
      insurance: true,
      airportsForBaseFlowRetryFn: LocationUtility.getAirportsIndiaAsOriginAndUSAsDestination
    });
    FlightUtility.runSearchFlow(flightBookingParams);
    FlightUtility.runChooseMockOnewayResultFlow();
    FlightUtility.runCheckoutFlow(flightBookingParams);
    FlightUtility.runItineraryFlow();
  });
});
