import type { BookingConfirmationRoom } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" import { BreakfastPackageEnum } from "@/types/enums/breakfast" import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation" export function mapRoomState( booking: BookingConfirmationSchema, room: BookingConfirmationRoom ) { const breakfast = booking.packages.find( (pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST ) const breakfastIncluded = booking.packages.some( (pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST ) return { adults: booking.adults, bedDescription: room.bedType.description, breakfast, breakfastIncluded, children: booking.childrenAges.length, childrenAges: booking.childrenAges, childBedPreferences: booking.childBedPreferences, confirmationNumber: booking.confirmationNumber, currencyCode: booking.currencyCode, fromDate: booking.checkInDate, name: room.name, packages: booking.packages, rateDefinition: booking.rateDefinition, roomFeatures: booking.packages.filter((p) => p.type === "RoomFeature"), roomPrice: booking.roomPrice, roomTypeCode: booking.roomTypeCode, toDate: booking.checkOutDate, totalPrice: booking.totalPrice, totalPriceExVat: booking.totalPriceExVat, vatAmount: booking.vatAmount, } }