import { User_Type } from '@support-onboard/data_model/user_type';
import { HelpCenter } from '@helpcenter-lib/helpcenter';
import { ChatApiIntercept, ChatBox, CSat, Banner } from '@chat-lib/index';
import { LocationUtility } from '@utility-lib/location';
import { LoginPage } from '@admin-lib/index';
import { HotelInterceptApis } from '@hotel-lib/index';
import {
  RentalCarDropOffType,
  RentalCarLocationType,
  RentalCarUtility,
  RentalCarParams
} from '@rentalcar-modal/index';

import { RentalCarInterceptApis } from '@rentalCar-lib/index';

describe('Chat: ML supported flows', () => {
  xit(
    'C9568519: Use chat to change car booking via ML supported flow',
    { tags: ['@tier2'] },
    () => {
      LoginPage.createNewCompanyAndLoginWithUserByType({
        users: [User_Type.TRAVELER],
        companySuffix: '-avamltest'
      });
      RentalCarInterceptApis.interceptRentalCarApis();
      const rentalCarParams: RentalCarParams = {
        tripTileType: 'Business',
        dropOffType: RentalCarDropOffType.sameDropOff,
        pickUpLocation: LocationUtility.getHotelUS(),
        outOfPolicy: 'No',
        dropOffLocation: LocationUtility.getHotelUS(),
        rentalCarLocationType: RentalCarLocationType.hotelUS
      };
      RentalCarUtility.bookingWorkflow(rentalCarParams);
      ChatApiIntercept.interceptChatApis();
      HotelInterceptApis.interceptHotelApis();
      HelpCenter.visitPage();
      ChatBox.openChatWithAva();
      ChatBox.selectMsgYouWannaSendBackToAva('No');
      ChatBox.typeMsgToAva(`I want to change the dropoff location for my rental car`);
      ChatBox.readAvaMsgAndTypeReply('car rental', 'Yes');
      CSat.submitCSatScore(5);
      CSat.expectCSatScoreSubmitted(5);
      CSat.skipAndConnetWithAgent();
      Banner.expectBannerContainsText('An agent will be with you shortly.');
    }
  );
});
