import {z} from 'zod' import {i18nLocalesCodes} from '@/i18n-config' import {metaFormSchema} from '@/lib/schemas/meta' export const productLocaleSchema = z.object({ lang: z.enum(i18nLocalesCodes), title: z.coerce.string().trim().min(1).max(384), shortTitle: z.coerce.string().trim().max(191).optional(), headingTitle: z.coerce.string().trim().max(191).optional(), description: z.coerce.string().trim(), content: z.coerce.string().trim().optional(), instruction: z.coerce.string().trim().optional() }) export const createProductFormSchema = z.object({ image: z.coerce.string().trim().max(512).optional(), published: z.coerce.boolean().default(false).optional(), // ProductToStore price: z.coerce .string() .min(2) .regex(/^\d{1,7}(\.\d{1,2})?$/, { message: 'Максимум 7 цифр до крапки та 2 після неї' }), // ProductToStore pricePromotional: z.coerce .string() .regex(/^\d{1,7}(\.\d{1,2})?$/, { message: 'Максимум 7 цифр до крапки та 2 після неї' }) .optional(), // ProductToStore locales: z.array(productLocaleSchema), meta: z.array(metaFormSchema) }) // // files: z // .array( // z.object({ // file: z.any(), // alt: z.string().min(1, {message: 'Значення тегу Alt необхідне'}), // title: z.string().min(1, {message: 'Значення тегу title необхідне'}) // }) // ) // .nonempty({message: 'Необхідно обрати хоча б один файл'})