import {
  bookingCancelRescheduleTestData,
  bookingCancelRevokeTestData,
  bookingCancelTestData,
  bookingEditNotesTestData,
} from '@/manager/modules/booking/data/booking-edit-test-data';
import { test } from '@/manager/modules/booking/booking-fixtures';
import {
  expectBookingToBeCanceled,
  expectBookingNotesToBeEdited,
  expectBookingCancellationToBeRescheduled,
  expectBookingCancellationToBeRevoked,
} from '@/manager/modules/booking/utils/booking-edit-expect-utils';

// TODO: due to Stripe limitations the required bookings must be created via the manager for now
// TODO: due to Stripe concurrency issues the booking edit tests must be run sequentially for now

test.describe.configure({ mode: 'default' });

for (const data of bookingEditNotesTestData) {
  test(data.description, async ({ bookingListPage }) => {
    await expectBookingNotesToBeEdited(bookingListPage, data.booking, data.changes);
  });
}

for (const data of bookingCancelTestData) {
  test(data.description, async ({ bookingListPage }) => {
    await expectBookingToBeCanceled(bookingListPage, data.booking, data.cancellation);
  });
}

for (const data of bookingCancelRescheduleTestData) {
  test(data.description, async ({ bookingListPage }) => {
    await expectBookingCancellationToBeRescheduled(bookingListPage, data.booking, data.cancellation);
  });
}

for (const data of bookingCancelRevokeTestData) {
  test(data.description, async ({ bookingListPage }) => {
    await expectBookingCancellationToBeRevoked(bookingListPage, data.booking, data.cancellation);
  });
}
