import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { HelpCenter } from '@helpcenter-lib/helpcenter';
import { ChatApiIntercept, ChatBox, CSat, Banner } from '@chat-lib/index';
import { LocationUtility } from '@utility-lib/location';
import moment = require('moment');
import { Timeouts } from '@utility-lib/index';
const DATE_FORMAT = 'YYYY-MM-DD';

describe('Chat: ML unsupported flows', () => {
  xit(
    'C9615708: Use chat to change hotel booking via ML unsupported flow',
    { tags: ['@tier2'] },
    () => {
      const bookingData1 = {
        location: LocationUtility.getCityUS(),
        checkInDate: moment(moment()).add(10, 'days').format(DATE_FORMAT),
        checkOutDate: moment(moment()).add(11, 'days').format(DATE_FORMAT),
        tripName: 'Cypress Second Hotel Booking',
        reason: 'AvaChatTestUnsupp',
        tripId: 'NEW'
      };

      LoginPage.createNewCompanyAndLoginWithUserByType({
        users: [User_Type.ADMIN],
        companySuffix: '-avamltest'
      });
      LoginPage.createHotelBookingForOnBoardingCompany(bookingData1);
      ChatApiIntercept.interceptChatApis();
      HelpCenter.visitPage();
      ChatBox.openChatWithAva();
      ChatBox.selectMsgYouWannaSendBackToAva('No');
      ChatBox.typeMsgToAva(`I want to add breakfast to my upcoming hotel booking`);
      ChatBox.readAvaMsgAndTypeReply('confirm', 'Yes');
      ChatBox.waitUntilAvaStopTyping();
      cy.wait(Timeouts.MEDIUM_TIMEOUT_30_SEC.timeout);
      ChatBox.readAvaMsgAndSelectReply(' refundable', 'hange');
      CSat.submitCSatScore(5);
      CSat.expectCSatScoreSubmitted(5);
      CSat.skipAndConnetWithAgent();
      Banner.expectBannerContainsText('An agent will be with you shortly.');
    }
  );
});
