import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { HotelInterceptApis, Hotels } from '@hotel-lib/index';
import { Rewards } from '../lib/rewards';

describe('Rewards: PFR - Book for self', () => {
  beforeEach(() => {
    // use company suffix parameter to enable rewards splits for the company
    LoginPage.createNewCompanyAndLoginWithUserByType({
      users: [User_Type.TRAVELER],
      companySuffix: 'rewards'
    });
    HotelInterceptApis.interceptHotelApis();
  });

  it('C6755289: PFR - Self booking flow', { tags: ['@tier1'] }, () => {
    Hotels.visitHotelSearch();
    Rewards.verifyRewardsOnGlobalNav();
    Hotels.selectHotelLocation('Seattle, WA, United States');
    Hotels.setCheckInCheckOutDate();
    Hotels.searchHotel();
    Rewards.verifyRewardsBadgeShown();
    Rewards.selectRewardsHotel(0);
    Rewards.selectRewardsRoomOption();
    Rewards.checkoutRewardsRoom();
    Rewards.verifyRewardsShownAtCheckout();
    Rewards.clickBookNow();
    Rewards.waitForBookingConfirmationModal();
    Rewards.validateUpsellModal();
    Rewards.verifyRewardsItinerary();
  });
});
