import { z } from "zod"; import zodToCamelCase from "zod-to-camel-case"; import { actionsSchema } from "@/schema/published/components/actions/actions.schema"; export const selectByProgrammeFieldsItemSchema = z .object({ subject_id: z.number(), tier_id: z.number(), examboard_id: z.number(), year_id: z.number(), keystage_id: z.number(), phase_id: z.number(), pathway_id: z.number(), subject_slug: z.string(), legacy: z.string(), }) .partial(); export const selectByFeaturesItemSchema = z.record( z.string(), z.union([z.boolean(), z.string()]), ); export const overridesAndExceptionsSchema = z.object({ overrides_and_exceptions_id: z.number().int(), select_by_programme_fields: z.array(selectByProgrammeFieldsItemSchema), select_by_features: z.array(selectByFeaturesItemSchema), actions: actionsSchema, description: z.string().nullable(), used_by_queries: z.array(z.string()), created_at: z.string().nullable(), updated_at: z.string().nullable(), }); export type OverridesAndExceptions = z.infer< typeof overridesAndExceptionsSchema >; export const overridesAndExceptionsSchemaCamel = zodToCamelCase( overridesAndExceptionsSchema, ); export type OverridesAndExceptionsCamel = z.infer< typeof overridesAndExceptionsSchemaCamel >;