import { z } from "zod/mini" // Options can be string, number, or boolean - all coerced to string // Matches io-ts behavior: t.union([t.string, StringFromNumber, StringFromBoolean]) const SelectOptionSchema: z.ZodMiniType = z.union([ z.string(), z.pipe( z.number(), z.transform((n) => n.toString()), ), z.pipe( z.boolean(), z.transform((b) => b.toString()), ), ]) const SelectConfigSchema = z.object({ label: z.nullish(z.string()), placeholder: z.optional(z.string()), default_value: z.optional(z.string()), options: z.optional(z.array(SelectOptionSchema)), }) export const SelectModelSchema = z.object({ type: z.literal("Select"), fieldset: z.nullish(z.string()), config: z.optional(SelectConfigSchema), }) export type SelectModel = z.infer