import { z } from 'zod'; import { ListSchema } from './common'; import { CustomerHalSchema } from './customer'; export const CardSchema = z.object({ photoUrl: z.string(), isActive: z.boolean(), isTemporary: z.boolean(), endDate: z.iso.date().nullable(), barcode: z.object({ type: z.string(), value: z.string(), }), }); export type Card = z.infer; export const CardHalSchema = CardSchema.extend({ _embedded: z .object({ customer: CustomerHalSchema.optional(), }) .nullable() .optional(), _links: z.object({ self: z.object({ href: z.string(), }), }), }); export type CardHal = z.infer; export const CardHalListSchema = ListSchema.extend({ _embedded: z.object({ cards: z.array(CardHalSchema), }), }); export type CardHalList = z.infer; export const CardDownloadSchema = z.object({}); export type CardDownload = z.infer; export const CardDownloadSchemaHalSchema = CardDownloadSchema.extend({ _links: z.object({ self: z.object({ href: z.string(), }), pdf: z.object({ href: z.string(), }), }), }); export type CardDownloadHal = z.infer; export const CardDownloadInputSchema = z.object({ barcode: z.string(), }); export type CardDownloadInput = z.infer;