import Joi from 'joi';

export const profileUpdateSchema = Joi.object({
    prefix: Joi.object({
        th: Joi.string().optional(),
        en: Joi.string().optional()
    }).optional(),
    first_name: Joi.string()
        .min(1)
        .max(100)
        .optional(),
    last_name: Joi.string()
        .min(1)
        .max(100)
        .optional(),
    phone: Joi.string()
        .min(10)
        .max(15)
        .optional(),
    avatar_url: Joi.string().optional(),
    birth_date: Joi.date().optional()
});

export const changePasswordSchema = Joi.object({
    oldPassword: Joi.string()
        .min(6)
        .max(100)
        .required()
        .messages({
            'string.min': 'Old password must be at least 6 characters',
            'string.max': 'Old password must not exceed 100 characters',
            'any.required': 'Old password is required'
        }),
    newPassword: Joi.string()
        .min(6)
        .max(100)
        .required()
        .messages({
            'string.min': 'New password must be at least 6 characters',
            'string.max': 'New password must not exceed 100 characters',
            'any.required': 'New password is required'
        })
});

