96 lines
2.6 KiB
TypeScript
96 lines
2.6 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
|
import { Country } from "@/types/enums/country"
|
|
|
|
export const getHotelsAvailabilityInputSchema = z.object({
|
|
cityId: z.string(),
|
|
roomStayStartDate: z.string(),
|
|
roomStayEndDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.string().optional(),
|
|
bookingCode: z.string().optional().default(""),
|
|
})
|
|
|
|
export const getRoomsAvailabilityInputSchema = z.object({
|
|
hotelId: z.number(),
|
|
roomStayStartDate: z.string(),
|
|
roomStayEndDate: z.string(),
|
|
adults: z.number(),
|
|
children: z.string().optional(),
|
|
bookingCode: z.string().optional(),
|
|
rateCode: z.string().optional(),
|
|
})
|
|
|
|
export const getSelectedRoomAvailabilityInputSchema = 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(),
|
|
packageCodes: z.array(z.nativeEnum(RoomPackageCodeEnum)).optional(),
|
|
})
|
|
|
|
export type GetSelectedRoomAvailabilityInput = z.input<
|
|
typeof getSelectedRoomAvailabilityInputSchema
|
|
>
|
|
|
|
export type GetRoomsAvailabilityInput = z.input<
|
|
typeof getRoomsAvailabilityInputSchema
|
|
>
|
|
|
|
export const getRatesInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
})
|
|
|
|
export const getHotelDataInputSchema = z.object({
|
|
hotelId: z.string(),
|
|
language: z.string(),
|
|
isCardOnlyPayment: z.boolean().optional(),
|
|
})
|
|
|
|
export type HotelDataInput = z.input<typeof getHotelDataInputSchema>
|
|
|
|
export const getHotelsInput = 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 GetHotelsInput extends z.infer<typeof getHotelsInput> {}
|
|
|
|
export const getBreakfastPackageInputSchema = 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 getRoomPackagesInputSchema = 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([]),
|
|
})
|
|
export const getCityCoordinatesInputSchema = z.object({
|
|
city: z.string(),
|
|
hotel: z.object({
|
|
address: z.string().optional(),
|
|
}),
|
|
})
|