import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import {
  HotelInterceptApis,
  Hotels,
  HotelSearchResults,
  HotelCheckout
} from '@hotel-lib/index';
import { Checkout, Itinerary } from '../../../lib';
import { Utility } from '@utility-lib/utility';
import { PersonalInterceptApis } from '../../../lib/api-intercept';

describe('Personal Travel: Bleisure - Adding hotel nights from checkout', () => {
  beforeEach(() => {
    LoginPage.createNewCompanyAndLoginWithUserByType({
      users: [User_Type.ADMIN],
      companySuffix: 'rewards'
    });
    HotelInterceptApis.interceptHotelApis();
    PersonalInterceptApis.interceptPersonalTravelApis();
  });

  it(
    'C7388402: Book for self - User should be able to extend the trip for same hotel on personal booking at checkout',
    { tags: ['@tier2'] },
    () => {
      Hotels.visitHotelSearch();
      Utility.selectTripTileType('Business');
      Hotels.selectHotelLocation('Seattle, WA, US');
      Hotels.setCheckInCheckOutDate();
      Hotels.searchHotel();
      HotelSearchResults.selectHotel(0);
      HotelSearchResults.selectRoomOption();
      HotelCheckout.waitToBeLoaded();
      HotelCheckout.createNewTripInfo();
      Checkout.verifyCheckoutUpsell();
      Checkout.extendRoomAtCheckout();
      Itinerary.verifyItinerary();
    }
  );
});
