import { z } from "zod";

export const createClientSchema = z.object({
  name: z.string().min(1, "Le nom du client est requis").max(120),
  email: z.string().email("Email invalide").min(1, "Email requis"),
  contactFirstName: z.string().min(1).max(80).nullable().optional(),
  contactLastName: z.string().min(1).max(80).nullable().optional(),
  phone: z.string().max(40).nullable().optional(),
  address: z.string().max(500).nullable().optional(),
  siret: z
    .string()
    .regex(/^\d{14}$/u, "Le SIRET doit contenir 14 chiffres")
    .nullable()
    .optional(),
  notes: z.string().max(2000).nullable().optional(),
});

export const updateClientSchema = createClientSchema.partial();

export type CreateClientInput = z.infer<typeof createClientSchema>;
export type UpdateClientInput = z.infer<typeof updateClientSchema>;
