import { z } from 'zod'; /** * Vietnamese phone number rule: * - 9–11 digits, optional leading +84 or 0. * We keep validation pragmatic: whitespace is stripped, then the remaining * string must be 9–11 digits (country code / leading zero stripped). */ const PHONE_REGEX = /^(?:\+?84|0)?\d{9,11}$/; export const inquiryFormSchema = z.object({ message: z .string({ error: 'Vui lòng nhập nội dung tin nhắn' }) .trim() .min(1, 'Vui lòng nhập nội dung tin nhắn') .max(2000, 'Tin nhắn không được vượt quá 2000 ký tự'), phone: z .string({ error: 'Vui lòng nhập số điện thoại' }) .trim() .min(9, 'Vui lòng nhập số điện thoại hợp lệ') .regex(PHONE_REGEX, 'Số điện thoại không hợp lệ'), }); export type InquiryFormData = z.infer;