import { LoginPage } from '@admin-lib/index';
import {
  HotelCheckout,
  HotelInterceptApis,
  Hotels,
  HotelSearchResults
} from '@hotel-lib/index';
import { Rewards } from '../lib/rewards';
import { stagingUsers } from '@fixtures/staging-users';
import { Utility } from '@utility-lib/utility';

const newUserCredentials = Cypress.env('newUser').NEW_USER_PASSWORD;
describe('Rewards: Personal - Bookings', () => {
  beforeEach(() => {
    LoginPage.visitTALoginPage();
    LoginPage.loginWithCredentials(stagingUsers.cfr_user.email, newUserCredentials);
    HotelInterceptApis.interceptHotelApis();
  });

  it(
    'C6755294: Burn flow - Personal hotel booking by redeeming rewards',
    { tags: ['@tier2'] },
    () => {
      Hotels.visitHotelSearch();
      Utility.selectTripTileType('Personal');
      Hotels.selectHotelLocation('Hyderabad, Telangana, India');
      Utility.selectFutureDate(2, 0, 1);
      Hotels.searchHotel();
      Rewards.verifyRewardsBadgeShown();
      HotelSearchResults.selectHotel(0);
      HotelSearchResults.selectRoomOption();
      HotelCheckout.createNewTripInfo();
      HotelCheckout.hotelCancellationAndChargePolicy();
      Rewards.verifyRedeemRewardsShown();
    }
  );
});
