import { GuestInvite } from '@admin-factory/interface';
import { faker } from '@faker-js/faker';
import { Dates } from '@utility-lib/dates';

export function createFlightGuestInvitePolicy(
  userResponse: any,
  paymentMethodUuid: string
): GuestInvite {
  return {
    invitees: [
      {
        givenName: faker.name.firstName(),
        familyName: faker.name.lastName().replace(/'/g, ''),
        email: userResponse.email,
        billTo: 'Not Applicable',
        department: 'Not Applicable'
      }
    ],
    tripInvitation: {
      extraGuestAllowed: false,
      purpose: `FlightEventOOP-${faker.datatype.number({ min: 10000000 })}`,
      location: 'San Francisco International Airport (SFO), San Francisco, CA, USA',
      customBookingWindowDays: null,
      hasCustomBookingWindow: false,
      hotelRestrictions: false,
      returnFlightTimeLocked: false,
      destinationAirport: '',
      flightBookingAllowed: true,
      flightBookingInstructions: '',
      flightMaxPriceLocale: '',
      recommendedHotels: [],
      hotelBookingAllowed: false,
      hotelBookingInstructions: '',
      hotelMaxPriceLocale: '',
      railBookingAllowed: false,
      railBookingInstructions: '',
      railMaxPriceLocale: '',
      carRentalCompanyName: '',
      carBookingAllowed: false,
      carBookingInstructions: '',
      carMaxPriceLocale: '',
      flightItineraryType: [],
      railItineraryType: [],
      generalInstructions: '',
      companyPaymentMethodUuid: paymentMethodUuid,
      hotelRateTypes: ['PAY_NOW'],
      startDateTime: Dates.getDateTime(32).slice(0, 10).concat('T12:00'),
      endDateTime: Dates.getDateTime(34).slice(0, 10).concat('T12:00'),
      travelEarliestDepartureDateTime: Dates.getDateTime(31)
        .slice(0, 10)
        .concat('T12:00'),
      travelLatestReturningDateTime: Dates.getDateTime(35).slice(0, 10).concat('T12:00'),
      contact: {
        uuid: userResponse.uuid
      },
      flightMaxPrice: 0,
      railMaxPrice: 0,
      hotelMaxPrice: 0,
      carMaxPrice: 0,
      locationGooglePlaceId: 'ChIJVVVVVYx3j4ARP-3NGldc8qQ',
      billTo: '',
      department: '',
      reminderEmailConfig: {
        repeatEveryDays: null,
        remindBeforeDays: null
      },
      companyPolicyLevel: {
        dateCreated: userResponse.companyPolicyLevel.dateCreated,
        dateUpdated: userResponse.companyPolicyLevel.dateUpdated,
        level: 'DEFAULT',
        mediumHaulEnabled: false,
        name: 'DEFAULT',
        uuid: userResponse.companyPolicyLevel.uuid
      },
      companyCarDirectBillPaymentMethods: [],
      customFieldValues: []
    }
  };
}
