73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
import { z } from "zod"
|
|
|
|
const roomsSchema = z.array(
|
|
z.object({
|
|
adults: z.number().int().nonnegative(),
|
|
childrenAges: z
|
|
.array(
|
|
z.object({
|
|
age: z.number().int().nonnegative(),
|
|
bedType: z.string(),
|
|
})
|
|
)
|
|
.default([]),
|
|
rateCode: z.string(),
|
|
roomTypeCode: z.string(),
|
|
guest: z.object({
|
|
title: z.string(),
|
|
firstName: z.string(),
|
|
lastName: z.string(),
|
|
email: z.string().email(),
|
|
phoneCountryCodePrefix: z.string(),
|
|
phoneNumber: z.string(),
|
|
countryCode: z.string(),
|
|
membershipNumber: z.string().optional(),
|
|
}),
|
|
smsConfirmationRequested: z.boolean(),
|
|
packages: z.object({
|
|
breakfast: z.boolean(),
|
|
allergyFriendly: z.boolean(),
|
|
petFriendly: z.boolean(),
|
|
accessibility: z.boolean(),
|
|
}),
|
|
})
|
|
)
|
|
|
|
const paymentSchema = z.object({
|
|
paymentMethod: z.string(),
|
|
card: z
|
|
.object({
|
|
alias: z.string(),
|
|
expiryDate: z.string(),
|
|
cardType: z.string(),
|
|
})
|
|
.optional(),
|
|
cardHolder: z.object({
|
|
email: z.string().email(),
|
|
name: z.string(),
|
|
phoneCountryCode: z.string(),
|
|
phoneSubscriber: z.string(),
|
|
}),
|
|
success: z.string(),
|
|
error: z.string(),
|
|
cancel: z.string(),
|
|
})
|
|
|
|
// Mutation
|
|
export const createBookingInput = z.object({
|
|
hotelId: z.string(),
|
|
checkInDate: z.string(),
|
|
checkOutDate: z.string(),
|
|
rooms: roomsSchema,
|
|
payment: paymentSchema,
|
|
})
|
|
|
|
// Query
|
|
const confirmationNumberInput = z.object({
|
|
confirmationNumber: z.string(),
|
|
})
|
|
|
|
export const bookingConfirmationInput = confirmationNumberInput
|
|
|
|
export const getBookingStatusInput = confirmationNumberInput
|