"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class permission extends sequelize_1.Model{static initModel(e){return permission.init({id:{type:sequelize_1.DataTypes.INTEGER,autoIncrement:!0,primaryKey:!0,allowNull:!1},name:{type:sequelize_1.DataTypes.STRING(255),allowNull:!1,validate:{notEmpty:{msg:"name: Name cannot be empty"}},comment:"Unique permission name (e.g., access.users, create.posts)"}},{sequelize:e,modelName:"permission",tableName:"permission",timestamps:!1,indexes:[{name:"PRIMARY",unique:!0,using:"BTREE",fields:[{name:"id"}]}]})}static associate(e){this.belongsToMany(e.role,{through:e.rolePermission,as:"roles",foreignKey:"permissionId",otherKey:"roleId",onDelete:"CASCADE",onUpdate:"CASCADE"})}}exports.default=permission;