"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class tag extends sequelize_1.Model{static initModel(e){return tag.init({id:{type:sequelize_1.DataTypes.UUID,defaultValue:sequelize_1.DataTypes.UUIDV4,primaryKey:!0,allowNull:!1,comment:"Unique identifier for the blog tag"},name:{type:sequelize_1.DataTypes.STRING(255),allowNull:!1,validate:{notEmpty:{msg:"name: Name cannot be empty"}},comment:"Display name of the tag"},slug:{type:sequelize_1.DataTypes.STRING(255),allowNull:!1,unique:"tagSlugKey",validate:{notEmpty:{msg:"slug: Slug cannot be empty"}},comment:"URL-friendly slug for the tag (used in URLs)"}},{sequelize:e,modelName:"tag",tableName:"tag",timestamps:!0,paranoid:!0,indexes:[{name:"PRIMARY",unique:!0,using:"BTREE",fields:[{name:"id"}]},{name:"tagSlugKey",unique:!0,using:"BTREE",fields:[{name:"slug"}]}]})}static associate(e){tag.hasMany(e.postTag,{as:"postTags",foreignKey:"tagId",onDelete:"CASCADE",onUpdate:"CASCADE"});tag.belongsToMany(e.post,{through:e.postTag,as:"posts",foreignKey:"tagId",otherKey:"postId",onDelete:"CASCADE",onUpdate:"CASCADE"})}}exports.default=tag;