export class SharedIntercepts {
  static intercepts() {
    cy.intercept('GET', '/api/uaa/userinfo').as('waitForUserInfo');
    cy.intercept('GET', new RegExp(`/api/uaa/userPlatformPermissions`)).as(
      'waitForLoadLoginPage'
    );

    cy.intercept('GET', new RegExp('/api/v2/user/bookableUsers/guests')).as(
      'waitForTravellers'
    );
    cy.intercept('GET', /api\/(v1|v2)\/user\/bookableUsers\/guests/).as(
      'waitForPersonalTravellers'
    );

    cy.intercept('GET', /api\/user\/autocomplete\/place/).as('waitForLocation');
    cy.intercept('GET', /maps\/api\/mapsjs/).as('waitForMapLoad');

    cy.intercept('GET', new RegExp('/trips/timeline\\?.+')).as('waitForTripTimeline');

    cy.intercept('GET', new RegExp('/api/user/trips/timeline\\?.+')).as(
      'waitForTripTimeline'
    );

    // hotel
    cy.intercept('GET', /api\/v1\/trip\/hotel\/searches/).as('waitForHotelSearch');

    // payment
    cy.intercept('GET', new RegExp('/api/v2/user/paymentMethods\\?.+')).as(
      'waitForPaymentMethods'
    );

    // trips
    cy.intercept('GET', /api\/user\/tripItems/).as('waitForManageItinerary');
    cy.intercept('GET', /api\/user\/passenger/).as('waitForUserDetails');
    cy.intercept('DELETE', /api\/user|admin\/bookings/).as('waitForCancelBooking');
  }
}
