import { z } from "zod/mini" import type { NestableLegacy } from "./nestable" import { NestableLegacySchema } from "./nestable" // Keep item values raw here: array-shaped legacy payloads are ambiguous until // `codec/group.ts` resolves the field model and picks the right decoder. export const GroupItemLegacySchema = z.record(z.string(), z.unknown()) export type GroupItemLegacy = z.infer export const GroupLegacySchema: z.ZodMiniType = z.array( z.union([GroupItemLegacySchema, z.null()]), ) export type GroupLegacy = (GroupItemLegacy | null)[] export const NestableAndGroupLegacySchema: z.ZodMiniType = z.union([ NestableLegacySchema, GroupLegacySchema, ]) export type NestableAndGroupLegacy = NestableLegacy | GroupLegacy