const Joi = require("joi");

// ========================
// Brand Validation
// ========================
const insertBrandSparepartSchema = Joi.object({
  sparepart_name: Joi.string().max(255).required(),
  brand_sparepart_description: Joi.string().max(255).required(),
  is_active: Joi.boolean().required(),
  error_code_id: Joi.number().required().messages({
    "any.required": "error_code_id is required",
    "number.base": "error_code_id must be a number",
  }),
  path_foto: Joi.string().max(255).optional().allow(''),
});

// Update Brand Validation
const updateBrandSparepartSchema = Joi.object({
  sparepart_name: Joi.string().max(255).required(),
  brand_sparepart_description: Joi.string().max(255).required(),
  is_active: Joi.boolean().optional(),
  error_code_id: Joi.number().required().messages({
    "any.required": "error_code_id is required",
    "number.base": "error_code_id must be a number",
  }),
  path_foto: Joi.string().max(255).optional().allow(''),
});

module.exports = {
  insertBrandSparepartSchema,
  updateBrandSparepartSchema,
};
