"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class mlmReferral extends sequelize_1.Model{static initModel(e){return mlmReferral.init({id:{type:sequelize_1.DataTypes.UUID,defaultValue:sequelize_1.DataTypes.UUIDV4,primaryKey:!0,allowNull:!1},referrerId:{type:sequelize_1.DataTypes.UUID,allowNull:!1,validate:{isUUID:{args:4,msg:"referrerId: Referrer ID must be a valid UUID"}}},referredId:{type:sequelize_1.DataTypes.UUID,allowNull:!1,validate:{isUUID:{args:4,msg:"referredId: Referred ID must be a valid UUID"}}},status:{type:sequelize_1.DataTypes.ENUM("PENDING","ACTIVE","REJECTED"),allowNull:!1,defaultValue:"PENDING",validate:{isIn:{args:[["PENDING","ACTIVE","REJECTED"]],msg:"status: Status must be one of PENDING, ACTIVE, REJECTED"}}}},{sequelize:e,modelName:"mlmReferral",tableName:"mlm_referral",timestamps:!0,paranoid:!0,indexes:[{name:"PRIMARY",unique:!0,using:"BTREE",fields:[{name:"id"}]},{name:"mlmReferralReferredIdKey",unique:!0,using:"BTREE",fields:[{name:"referredId"}]},{name:"mlmReferralReferrerIdReferredIdKey",unique:!0,using:"BTREE",fields:[{name:"referrerId"},{name:"referredId"}]}]})}static associate(e){mlmReferral.belongsTo(e.user,{as:"referrer",foreignKey:"referrerId",onDelete:"CASCADE",onUpdate:"CASCADE"});mlmReferral.belongsTo(e.user,{as:"referred",foreignKey:"referredId",onDelete:"CASCADE",onUpdate:"CASCADE"});mlmReferral.hasOne(e.mlmUnilevelNode,{as:"unilevelNode",foreignKey:"referralId",onDelete:"CASCADE",onUpdate:"CASCADE"});mlmReferral.hasOne(e.mlmBinaryNode,{as:"node",foreignKey:"referralId",onDelete:"CASCADE",onUpdate:"CASCADE"})}}exports.default=mlmReferral;