import vine from '@vinejs/vine' const RELANCE_TONES = ['amical', 'courtois', 'ferme', 'mise_en_demeure'] as const const planStep = vine.object({ // id optionnel : présent si on édite une étape existante, absent pour // une création (le contrôleur le générera). id: vine.string().optional(), order: vine.number().min(0), // Plage : -30 (rappel avant échéance) à 180 jours (gros retards). offsetDays: vine.number().min(-30).max(180), tone: vine.enum(RELANCE_TONES), subject: vine.string().minLength(1).maxLength(200), body: vine.string().minLength(1).maxLength(5000), requiresManualValidation: vine.boolean(), }) /** * Validator pour PATCH /plans/:slug. Tous les champs optionnels — l'éditeur * front peut envoyer juste `name` ou juste `steps` selon ce qu'il modifie. */ export const updatePlanValidator = vine.create({ name: vine.string().minLength(1).maxLength(80).optional(), description: vine.string().maxLength(500).optional(), steps: vine.array(planStep).minLength(1).maxLength(10).optional(), })