import {
  HotelInterceptApis,
  Hotels,
  HotelCheckout,
  HotelItinerary,
  SearchButtonType
} from '@hotel-lib/index';
import { Checkout } from '../../../lib';
import { Utility } from '@utility-lib/utility';
import { Rewards } from '../../../../rewards/lib/rewards';
const newUserCredentials = Cypress.env('newUser').NEW_USER_PASSWORD;

describe('Personal Travel: Bleisure - Adding hotel nights from checkout', () => {
  beforeEach(() => {
    Rewards.loginAsRewardsCompanyDelegate(newUserCredentials);
    Utility.visitSearchPage();
    Utility.selectTripTileType('Business');
    HotelInterceptApis.interceptHotelApis();
  });

  it(
    'C7388405: User should be able to add other LOB to the same trip as before',
    { tags: ['@tier2'] },
    () => {
      Checkout.bookExtensionForOthers();
      HotelItinerary.addNewTripInCurrentItinerary('Hotel');
      Hotels.clickOnSearchButton(SearchButtonType.COMMON);
      Rewards.selectRewardsHotel(0);
      Rewards.selectRewardsRoomOption();
      HotelCheckout.checkoutFLow('Business');
      HotelCheckout.expectHotelBookedSuccessfully('Hotel confirmed!');
      HotelItinerary.visitItinerary();
    }
  );
});
