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

const productValidation = [
  body('name').trim().notEmpty().withMessage('Product name is required.')
    .isLength({ max: 200 }).withMessage('Name must be under 200 characters.'),
  body('price').notEmpty().withMessage('Price is required.')
    .isFloat({ min: 0 }).withMessage('Price must be a positive number.'),
  body('stockQuantity').optional().isInt({ min: 0 }).withMessage('Stock must be a positive integer.'),
  body('categoryId').optional().isInt().withMessage('Invalid category.'),
];

module.exports = { productValidation };
