import { z } from 'zod'; import { ListSchema } from './common'; export const ReservationStatusSchema = z.enum([ 'DRAFT', 'ACTIVE', 'CANCELLED', 'COLLECTED', 'EXPIRED', 'RELEASED', ]); export type ReservationStatus = z.infer; export const ReservationSchema = z.object({ // TODO: Remove nullable when backend backfills the missing ids id: z.uuid().nullable(), customerId: z.uuid(), // TODO: Remove nullable when all tenants use schedule-service eventId: z.uuid().nullable(), productionId: z.uuid().nullable(), productionTitle: z.string().nullable(), // TODO: Remove nullable when all tenants use schedule-service venueId: z.uuid().nullable(), venueName: z.string(), eventStart: z.string(), status: ReservationStatusSchema, collectionDeadline: z.string().nullable(), releaseAfter: z.string().nullable(), createdByClientId: z.uuid().nullable(), }); export type Reservation = z.infer; export const ReservationHalSchema = ReservationSchema.extend({ _links: z.object({ self: z.object({ href: z.string(), }), event: z.object({ href: z.string(), }), }), }); export type ReservationHalSchemaType = z.infer; export const ReservationHalListSchema = ListSchema.extend({ _embedded: z.object({ reservations: z.array(ReservationHalSchema), }), }); export type ReservationHalListSchemaType = z.infer< typeof ReservationHalListSchema >;