import { LoginPage } from '@admin-lib/index';
import { Provider_Type, User_Type } from '@support-onboard/index';
import { Utility } from '@utility-lib/index';
import {
  TeamEventsInterceptApis,
  CreateEvent,
  EventDetails,
  EventsWorkflow
} from '@group-events-lib/index';
import { EventsPage } from 'cypress/e2e/gme/group_events/lib/events_page';

describe('GME: Team event: Send events', () => {
  beforeEach(() => {
    LoginPage.createNewCompanyAndLoginWithUserByType({
      providers: [Provider_Type.SABRE_FLIGHT],
      users: [User_Type.ADMIN]
    });

    TeamEventsInterceptApis.teamEventIntercept();
  });

  it('C50996: Send out invites for the Team Event', { tags: ['@tier1'] }, () => {
    const location = 'Zurich';
    const eventName = 'Zurich event';
    EventsWorkflow.createDraftEvent(location, eventName);
    EventDetails.verifyTeamEventSetupPageOpened(eventName);
    Utility.openEventsPage();
    EventsPage.selectEventByTitle(eventName);
    EventDetails.verifyTeamEventSetupPageOpened(eventName);
    EventDetails.switchTabs('participants');
    EventDetails.setEventParticipant();
    // EventDetails.verifyEstimatedPrice(); TODO: estimated price are 0 although they shouldn't be.
    EventDetails.sendInvite();
    EventDetails.expectTeamEventCreated();
    EventDetails.visitHomePage();
    CreateEvent.openSearchPage();
    CreateEvent.bookThisTripLater();
    CreateEvent.verifyUpcomingEventReviewButton();
    // check emails for the invites
  });
});
