import { z } from 'zod';

// src/components/typeform/schemas.ts
var answerValueSchema = z.discriminatedUnion("type", [
  z.object({ type: z.literal("preset"), value: z.string() }),
  z.object({ type: z.literal("custom"), value: z.string() })
]);
var multiAnswerValueSchema = z.array(answerValueSchema);
function radioWithOtherSchema(presetValues) {
  return z.discriminatedUnion("type", [
    z.object({
      type: z.literal("preset"),
      value: z.enum(presetValues)
    }),
    z.object({
      type: z.literal("custom"),
      value: z.string().min(1, "Please specify a value")
    })
  ]);
}
function checkboxWithOtherSchema(presetValues) {
  return z.array(
    z.discriminatedUnion("type", [
      z.object({
        type: z.literal("preset"),
        value: z.enum(presetValues)
      }),
      z.object({
        type: z.literal("custom"),
        value: z.string().min(1, "Please specify a value")
      })
    ])
  );
}

export { answerValueSchema, checkboxWithOtherSchema, multiAnswerValueSchema, radioWithOtherSchema };
