const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');


const MenuCategory = sequelize.define('MenuCategory', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    nom: {
        type: DataTypes.STRING(100),
        allowNull: false,
        unique: true,
        validate: {
            notEmpty: {
                msg: 'Le nom de la catégorie est requis'
            }
        }
    },
    description: {
        type: DataTypes.TEXT,
        allowNull: true
    },
    ordre: {
        type: DataTypes.INTEGER,
        defaultValue: 0
    },
    actif: {
        type: DataTypes.BOOLEAN,
        defaultValue: true
    }
}, {
    tableName: 'menu_categories',
    timestamps: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at'
});

module.exports = MenuCategory;
