import vine from '@vinejs/vine';
import { DateTime } from 'luxon';
export const createClientValidator = vine.compile(vine.object({
    fullName: vine.string().trim().maxLength(255).optional().nullable(),
    email: vine
        .string()
        .trim()
        .email()
        .unique(async (db, value) => {
        const client = await db.from('clients').where('email', value).first();
        return !client;
    }),
    password: vine.string().trim().minLength(6).maxLength(255),
    phone: vine.string().trim().maxLength(30).optional(),
    document: vine.string().trim().maxLength(50).optional(),
    birthdate: vine
        .date({ formats: ['YYYY-MM-DD'] })
        .transform((value) => DateTime.fromJSDate(value))
        .optional()
        .nullable(),
    expirationDate: vine
        .date({ formats: ['YYYY-MM-DD'] })
        .transform((value) => DateTime.fromJSDate(value))
        .optional()
        .nullable(),
}));
export const updateClientValidator = vine.compile(vine.object({
    fullName: vine.string().trim().maxLength(255).optional().nullable(),
    email: vine.string().trim().email().optional(),
    phone: vine.string().trim().maxLength(30).optional().nullable(),
    document: vine.string().trim().maxLength(50).optional().nullable(),
    birthdate: vine
        .date()
        .transform((value) => DateTime.fromJSDate(value))
        .optional()
        .nullable(),
    expirationDate: vine
        .date()
        .transform((value) => DateTime.fromJSDate(value))
        .optional()
        .nullable(),
}));
export const searchClientValidator = vine.compile(vine.object({
    searchText: vine.string().trim().optional(),
}));
export const loginClientValidator = vine.compile(vine.object({
    email: vine.string().trim().email(),
    password: vine.string().trim().minLength(6).maxLength(255),
}));
export const recoverClientPass = vine.compile(vine.object({
    email: vine.string().trim().email(),
}));
//# sourceMappingURL=client.js.map