import { z } from 'zod'; import { jsonSchema, ListSchema } from './common'; export const AssetsSchema = z.record( z.string(), z.object({ filetype: z.enum(['image', 'video']) }) ); export type AssetsSchemaType = z.infer; export const ProductionTypeSchema = z.object({ id: z.string(), attributesSchema: z.record(z.string(), jsonSchema), localizableAttributesSchema: z.record(z.string(), jsonSchema), eventAttributesSchema: z.record(z.string(), jsonSchema), eventLocalizableAttributesSchema: z.record(z.string(), jsonSchema), assetsSchema: AssetsSchema, createdAt: z.string(), updatedAt: z.string(), }); export const ProductionTypeHalSchema = ProductionTypeSchema.pick({ id: true, attributesSchema: true, localizableAttributesSchema: true, eventAttributesSchema: true, eventLocalizableAttributesSchema: true, assetsSchema: true, createdAt: true, updatedAt: true, }).extend({ _links: z.object({ self: z.object({ href: z.string(), }), }), }); export type ProductionTypeHalSchemaType = z.infer< typeof ProductionTypeHalSchema >; export const ProductionTypeHalListSchema = ListSchema.extend({ _embedded: z.object({ productionTypes: z.array(ProductionTypeHalSchema), }), }); export type ProductionTypeHalListSchemaType = z.infer< typeof ProductionTypeHalListSchema >;