import { z } from "zod";

export const dietaryTagsSchema = z.object({
  vegan: z.boolean().optional(),
  vegetarian: z.boolean().optional(),
  glutenFree: z.boolean().optional(),
  dairyFree: z.boolean().optional(),
  nutFree: z.boolean().optional(),
  halal: z.boolean().optional(),
  kosher: z.boolean().optional(),
});

export const stepSchema = z.object({
  instruction: z.string(),
  timerSeconds: z.number().int().optional(),
});

export function ingredientSchema<Q extends z.ZodTypeAny>(quantity: Q) {
  return z.object({
    rawName: z.string().describe(
      "The ingredient name ONLY — e.g. 'flour', 'egg', 'olive oil'. Never include the " +
      "quantity or unit here (not '2 cups flour', not '3 eggs'); those go in the separate " +
      "quantity and unit fields."
    ),
    quantity: quantity.optional().describe("A number only, e.g. 0.25, 1.5, 2 — never combined with the unit."),
    unit: z.string().optional().describe("The unit only, e.g. 'cup', 'tbsp', 'g', 'ml' — never combined with the quantity or name."),
    note: z.string().optional(),
  });
}
