import { z } from 'zod'; export const offeringFormSchema = z.object({ title: z.string().min(1, 'Title is required').max(100, 'Title must be 100 characters or fewer'), description: z .string() .min(1, 'Description is required') .max(500, 'Description must be 500 characters or fewer'), price: z.string().min(1, 'Price is required').max(50, 'Price must be 50 characters or fewer'), priceNote: z .string() .min(1, 'Price note is required') .max(100, 'Price note must be 100 characters or fewer'), features: z .array(z.string().min(1, 'Feature cannot be empty').max(200, 'Feature must be 200 characters or fewer')) .min(1, 'At least 1 feature is required') .max(10, 'At most 10 features are allowed'), ctaLabel: z.string().min(1, 'CTA label is required').max(50, 'CTA label must be 50 characters or fewer'), featured: z.boolean(), slug: z .string() .max(130, 'Slug must be 130 characters or fewer') .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Slug may only contain lowercase letters, digits and hyphens') .optional() .or(z.literal('')), /** Id of the chosen category; null/absent = no category. */ categoryId: z.string().nullable().optional(), }); export type OfferingFormData = z.infer; /** A category name as typed by an admin (already trimmed by the caller). */ export const categoryNameSchema = z.string().min(1).max(100);