189 lines
4.9 KiB
TypeScript
189 lines
4.9 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { Lang } from "@/constants/languages"
|
|
|
|
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
|
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
|
import { Country } from "@/types/enums/country"
|
|
|
|
export const hotelsAvailabilityInputSchema = z.object({
|
|
cityId: z.string(),
|
|
roomStayStartDate: z.string(),
|
|
roomStayEndDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.string().optional(),
|
|
bookingCode: z.string().optional().default(""),
|
|
redemption: z.boolean().optional().default(false),
|
|
})
|
|
|
|
export const getHotelsByHotelIdsAvailabilityInputSchema = z.object({
|
|
hotelIds: z.array(z.number()),
|
|
roomStayStartDate: z.string(),
|
|
roomStayEndDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.string().optional(),
|
|
bookingCode: z.string().optional().default(""),
|
|
})
|
|
|
|
export const roomsCombinedAvailabilityInputSchema = z.object({
|
|
adultsCount: z.array(z.number()),
|
|
bookingCode: z.string().optional(),
|
|
childArray: z
|
|
.array(
|
|
z
|
|
.array(
|
|
z.object({
|
|
age: z.number(),
|
|
bed: z.nativeEnum(ChildBedMapEnum),
|
|
})
|
|
)
|
|
.nullable()
|
|
)
|
|
.nullish(),
|
|
hotelId: z.string(),
|
|
lang: z.nativeEnum(Lang),
|
|
rateCode: z.string().optional(),
|
|
roomStayEndDate: z.string(),
|
|
roomStayStartDate: z.string(),
|
|
redemption: z.boolean().optional().default(false),
|
|
roomFeatureCodesArray: z
|
|
.array(z.array(z.nativeEnum(RoomPackageCodeEnum)).nullable())
|
|
.optional(),
|
|
})
|
|
|
|
export const selectedRoomAvailabilityInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
roomStayStartDate: z.string(),
|
|
roomStayEndDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.string().optional(),
|
|
bookingCode: z.string().optional(),
|
|
rateCode: z.string(),
|
|
roomTypeCode: z.string(),
|
|
counterRateCode: z.string().optional(),
|
|
packageCodes: z.array(z.nativeEnum(RoomPackageCodeEnum)).optional(),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
redemption: z.boolean().optional(),
|
|
})
|
|
|
|
export type GetSelectedRoomAvailabilityInput = z.input<
|
|
typeof selectedRoomAvailabilityInputSchema
|
|
>
|
|
|
|
export const ratesInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
})
|
|
|
|
export const hotelInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
isCardOnlyPayment: z.boolean(),
|
|
language: z.nativeEnum(Lang),
|
|
})
|
|
|
|
export const getHotelsByCSFilterInput = z.object({
|
|
locationFilter: z
|
|
.object({
|
|
city: z.string().nullable(),
|
|
country: z.nativeEnum(Country).nullable(),
|
|
excluded: z.array(z.string()),
|
|
})
|
|
.nullable(),
|
|
hotelsToInclude: z.array(z.string()),
|
|
})
|
|
export interface GetHotelsByCSFilterInput
|
|
extends z.infer<typeof getHotelsByCSFilterInput> {}
|
|
|
|
export const nearbyHotelIdsInput = z.object({
|
|
hotelId: z.string(),
|
|
})
|
|
|
|
export const getDestinationsMapDataInput = z
|
|
.object({
|
|
lang: z.nativeEnum(Lang),
|
|
warmup: z.boolean().optional(),
|
|
})
|
|
.optional()
|
|
|
|
export const breakfastPackageInputSchema = z.object({
|
|
adults: z.number().min(1, { message: "at least one adult is required" }),
|
|
fromDate: z
|
|
.string()
|
|
.min(1, { message: "fromDate is required" })
|
|
.pipe(z.coerce.date()),
|
|
hotelId: z.string().min(1, { message: "hotelId is required" }),
|
|
toDate: z
|
|
.string()
|
|
.min(1, { message: "toDate is required" })
|
|
.pipe(z.coerce.date()),
|
|
})
|
|
|
|
export const ancillaryPackageInputSchema = z.object({
|
|
fromDate: z
|
|
.string()
|
|
.min(1, { message: "fromDate is required" })
|
|
.pipe(z.coerce.date()),
|
|
hotelId: z.string().min(1, { message: "hotelId is required" }),
|
|
toDate: z.string().pipe(z.coerce.date()).optional(),
|
|
})
|
|
|
|
export const roomPackagesInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
startDate: z.string(),
|
|
endDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.number().optional().default(0),
|
|
packageCodes: z.array(z.string()).optional().default([]),
|
|
lang: z.nativeEnum(Lang),
|
|
})
|
|
export const cityCoordinatesInputSchema = z.object({
|
|
city: z.string(),
|
|
hotel: z.object({
|
|
address: z.string().optional(),
|
|
}),
|
|
})
|
|
|
|
export const getMeetingRoomsInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
language: z.string(),
|
|
})
|
|
|
|
export const getAdditionalDataInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
language: z.string(),
|
|
})
|
|
|
|
export const getHotelsByCountryInput = z.object({
|
|
country: z.nativeEnum(Country),
|
|
})
|
|
|
|
export const getHotelsByCityIdentifierInput = z.object({
|
|
cityIdentifier: z.string(),
|
|
})
|
|
|
|
export const getLocationsInput = z.object({
|
|
lang: z.nativeEnum(Lang),
|
|
})
|
|
|
|
export const getLocationsUrlsInput = z.object({
|
|
lang: z.nativeEnum(Lang),
|
|
})
|
|
|
|
export const roomFeaturesInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
startDate: z.string(),
|
|
endDate: z.string(),
|
|
adults: z.number(),
|
|
childrenInRoom: z
|
|
.array(
|
|
z.object({
|
|
age: z.number(),
|
|
bed: z.nativeEnum(ChildBedMapEnum),
|
|
})
|
|
)
|
|
.optional(),
|
|
roomFeatureCodes: z.array(z.nativeEnum(RoomPackageCodeEnum)).optional(),
|
|
roomIndex: z.number().optional(),
|
|
})
|
|
|
|
export type RoomFeaturesInput = z.input<typeof roomFeaturesInputSchema>
|