import { z } from 'zod'; const amount = z .string() .regex(/^(0|[1-9]\d{0,9})\.\d{2}$/) .refine((value) => value !== '0.00'); export const supplierPaymentSchema = z .object({ idempotencyKey: z.uuid(), reference: z .string() .trim() .min(1) .max(80) .regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/) .transform((value) => value.toUpperCase()), method: z.enum(['BANK_TRANSFER', 'UPI', 'CHEQUE', 'CASH', 'OTHER']), amount, paidDate: z.iso .date() .transform((value) => new Date(`${value}T00:00:00.000Z`)), }) .strict(); export const supplierPaymentReversalSchema = z .object({ reason: z.string().trim().min(1).max(500) }) .strict(); export type SupplierPaymentInput = z.infer; export type SupplierPaymentReversalInput = z.infer< typeof supplierPaymentReversalSchema >;