feat(SW-176): add schemas

This commit is contained in:
Fredrik Thorsson
2024-08-22 15:03:41 +02:00
parent 31b239c577
commit deb3151edc
5 changed files with 79 additions and 1 deletions

View File

@@ -468,6 +468,64 @@ export const getHotelDataSchema = z.object({
included: z.array(roomSchema).optional(),
})
const occupancySchema = z.object({
adults: z.number(),
children: z.number(),
})
const bestPricePerStaySchema = z.object({
currency: z.string(),
amount: z.number(),
regularAmount: z.number(),
memberAmount: z.number(),
discountRate: z.number(),
discountAmount: z.number(),
points: z.number(),
numberOfVouchers: z.number(),
numberOfBonusCheques: z.number(),
})
const bestPricePerNightSchema = z.object({
currency: z.string(),
amount: z.number(),
regularAmount: z.number(),
memberAmount: z.number(),
discountRate: z.number(),
discountAmount: z.number(),
points: z.number(),
numberOfVouchers: z.number(),
numberOfBonusCheques: z.number(),
})
const linksSchema = z.object({
links: z.array(
z.object({
url: z.string(),
type: z.string(),
})
),
})
const availabilitySchema = z.object({
data: z.array(
z.object({
attributes: z.object({
checkInDate: z.date(),
checkOutDate: z.date(),
occupancy: occupancySchema,
status: z.string(),
hotelId: z.number(),
ratePlanSet: z.string(),
bestPricePerStay: bestPricePerStaySchema,
bestPricePerNight: bestPricePerNightSchema,
}),
relationships: linksSchema,
})
),
})
export const getAvailabilitySchema = availabilitySchema
const flexibilityPrice = z.object({
standard: z.number(),
member: z.number(),