import { TeamEventParamsStringInvitees } from '@group-events-lib/interface';

export function generateEventData(teamEventParams: TeamEventParamsStringInvitees) {
  const { eventName, locationType, inviteeIdsOrEmails, startDate, endDate, placeId } =
    teamEventParams;
  return {
    companyOfficeUuid: null,
    eventName: eventName,
    locationType: locationType,
    items: inviteeIdsOrEmails.map((inviteeId) => ({
      inviteeUuid: inviteeId
    })),
    startDateTime: startDate,
    endDateTime: endDate,
    placeId: placeId
  };
}

export function generateEventEditData(eventName: string) {
  return {
    customFieldValues: [
      {
        label: 'Trip Name',
        name: 'tripName',
        value: eventName
      }
    ]
  };
}

export function generateEventItemDataWithCarsTrains(item: any) {
  return {
    uuid: item.uuid,
    inviteeUuid: item.invitee.uuid,
    departurePlaceId: null,
    departurePlaceDisplayName: null,
    departureLocation: null,
    allowedBookingsDetails: {
      HOTEL: {
        estimatedCost: null,
        estimatedCostML: null,
        error: null,
        tripItemType: 'HOTEL'
      },
      FLIGHT: {
        estimatedCost: null,
        estimatedCostML: null,
        error: null,
        tripItemType: 'FLIGHT'
      },
      CAR: {},
      RAIL: {}
    }
  };
}
