const Joi = require("joi");

const { Validate } = require("./Validate");

const FeedbackValidation = async (req, res, next) => {
  const schema = Joi.object().keys({
    propertyId: Joi.number().integer().required().messages({
      "any:required": "PropertyId field is required",
    }),
    rating: Joi.number().integer().min(0).max(5).required().messages({
      "any:required": "Rating field is required",
    }),
    description: Joi.string().required().messages({
      "any:required": "Description field is required",
    }),
  });
  await Validate(req, res, next, schema);
};

module.exports = {
  FeedbackValidation,
};
