const Joi = require("joi");
const {
  firstName,
  lastName,
  userName,
  email,
  mobileNo,
} = require("./CommonValidation");
const { Validate } = require("./Validate");

const UserValidation = async (req, res, next) => {
  const schema = Joi.object().keys({
    firstName: Joi.string().optional().allow("",null).messages({
      "any.required": "First Name field is required",
    }),
    lastName: Joi.string().optional().allow("",null).messages({
      "any.required": "Last Name field is required",
    }),
    email: Joi.string().optional().allow("",null).messages({
      "any.required": "email field is required",
    }),
    mobileNo: Joi.string().optional().allow("",null).messages({
      "any.required": "Mobile No field is required",
    }),
    image: Joi.any().optional(),
    coverImage: Joi.any().optional(),
  });
  await Validate(req, res, next, schema);
};

module.exports = {
  UserValidation,
};
