import { GuestInviteUtility, LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { Utility } from '@utility-lib/index';

const newUserPassword = Cypress.env('newUser').NEW_USER_PASSWORD;

describe('GME: manage guest invites for internal users', () => {
  beforeEach(() => {
    LoginPage.createNewCompanyAndLoginWithUserByType({ users: [User_Type.ADMIN] });
    LoginPage.createNewTravelerAndLogin();
    cy.getCurrentUserInfo();
    Utility.loginAsAdmin(newUserPassword);
    cy.createGuestInvitePaymentMethod();
  });

  it(
    'C391128: Create and send Guest invite with Extra guest',
    { tags: ['@tier1'] },
    () => {
      GuestInviteUtility.createGuestInviteForInternalUser(true);
    }
  );

  it(
    'C51005: Create and send Guest invite to internal user',
    { tags: ['@tier1'] },
    () => {
      GuestInviteUtility.createGuestInviteForInternalUser();
    }
  );

  afterEach(() => {
    // TODO: we do not allow to revoke fully booked invitation
    // option 1: remove this code
    // option 2: add logic to revoke fully booked invitation
    // option 3: add more allowed verticals so that invitation is not fully booked
    // cy.revokeInvitation();
    // cy.deletePaymentMethod();
  });
});
