import { LocationUtility } from '@utility-lib/location';
import { ChatBox, ChatApiIntercept } from '@chat-lib/index';
import { FlightBookingParams, FlightBookingUtility } from '@flight-modal/index';
import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { FlightInterceptApis, FlightTripType, Flights } from '@flight-lib/index';
import { HelpCenter } from '@helpcenter-lib/helpcenter';
import { Utility } from '@utility-lib/index';

describe('Chat: Flight searching', () => {
  it.skip('C7900545: Ava IQ ask about near trip', { tags: ['@tier2'] }, () => {
    const flightBookingParams: FlightBookingParams =
      FlightBookingUtility.initFlightBookingParams({
        locations: LocationUtility.getPairOfOriginAndDestinationAirportsUSWithShortName(),
        flightTripType: FlightTripType.ROUNDTRIP,
        tripTileType: 'Business'
      });
    const daysToMove = { daysToMove: 31, daysAfterMovedDays: 1 };

    ChatApiIntercept.interceptChatApis();
    FlightInterceptApis.interceptFlightsApis();
    LoginPage.createNewCompanyAndLoginWithUserByType({
      users: [User_Type.ADMIN],
      companySuffix: '-avacsate2etest'
    });
    Flights.visitFlightSearchPage();
    Flights.verifyFlightSearchOptionsIsAvailable('flight');
    Flights.selectFlightType(flightBookingParams.flightTripType);
    Flights.setLocations(flightBookingParams.locations);
    Utility.selectShiftedDate(daysToMove);
    Flights.searchFlight();

    HelpCenter.visitPage();
    ChatBox.openChatWithAva();
    ChatBox.expectMsgReceivedFromAva('It looks like you searched for:');
    ChatBox.validateFlightItinerary(flightBookingParams.locations);
  });
});
