const { body } = require('express-validator');

const validateUser = [
    body('firstName').notEmpty().withMessage('First name is required'),
    body('lastName').notEmpty().withMessage('Last name is required'),
    body('email').notEmpty().isEmail().withMessage('Invalid email'),
    // body('phone')
    //     .notEmpty()
    //     .withMessage('Phone number is required')
    //     .custom((value) => {
    //         // Accept phone numbers that start with "+" and have 7-15 digits
    //         const phoneRegex = /^\+?[1-9]\d{6,14}$/;
    //         if (!phoneRegex.test(value)) {
    //             throw new Error('Invalid phone number');
    //         }
    //         return true;
    //     }),
    body('password')
        .isLength({ min: 6 })
        .withMessage('Password must be at least 6 characters long'),
];

module.exports = { validateUser };
