"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class investmentPlan extends sequelize_1.Model{static initModel(e){return investmentPlan.init({id:{type:sequelize_1.DataTypes.UUID,defaultValue:sequelize_1.DataTypes.UUIDV4,primaryKey:!0,allowNull:!1,comment:"Unique identifier for the investment plan"},name:{type:sequelize_1.DataTypes.STRING(191),allowNull:!1,unique:"investmentPlanNameKey",validate:{notEmpty:{msg:"name: Name cannot be empty"}},comment:"Unique name identifier for the investment plan"},title:{type:sequelize_1.DataTypes.STRING(191),allowNull:!1,validate:{notEmpty:{msg:"title: Title cannot be empty"}},comment:"Display title of the investment plan shown to users"},image:{type:sequelize_1.DataTypes.STRING(191),allowNull:!0,validate:{is:{args:["^/(uploads|img)/.*$","i"],msg:"image: image must be a valid URL"}},comment:"URL path to the plan's image/logo"},description:{type:sequelize_1.DataTypes.TEXT,allowNull:!1,validate:{notEmpty:{msg:"description: Description cannot be empty"}},comment:"Detailed description of the investment plan"},currency:{type:sequelize_1.DataTypes.STRING(191),allowNull:!1,validate:{notEmpty:{msg:"currency: Currency cannot be empty"}},comment:"Currency code that this plan accepts for investment"},walletType:{type:sequelize_1.DataTypes.STRING(191),allowNull:!1,validate:{notEmpty:{msg:"walletType: Wallet type cannot be empty"}},comment:"Type of wallet (e.g., 'crypto', 'fiat') that this plan uses"},minAmount:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,validate:{isFloat:{msg:"minAmount: Minimum amount must be a valid number"}},comment:"Minimum amount of investment required for this plan"},maxAmount:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,validate:{isFloat:{msg:"maxAmount: Maximum amount must be a valid number"}},comment:"Maximum amount of investment allowed for this plan"},invested:{type:sequelize_1.DataTypes.INTEGER,allowNull:!1,defaultValue:0,validate:{isInt:{msg:"invested: Invested value must be an integer"}},comment:"Total amount of money invested in this plan"},profitPercentage:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,defaultValue:0,validate:{isFloat:{msg:"profitPercentage: Profit percentage must be a number"}},comment:"Expected profit percentage for this plan"},minProfit:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,validate:{isFloat:{msg:"minProfit: Minimum profit must be a number"}},comment:"Minimum profit amount for this plan"},maxProfit:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,validate:{isFloat:{msg:"maxProfit: Maximum profit must be a number"}},comment:"Maximum profit amount for this plan"},defaultProfit:{type:sequelize_1.DataTypes.INTEGER,allowNull:!1,defaultValue:0,validate:{isInt:{msg:"defaultProfit: Default profit must be an integer"}},comment:"Default profit amount for this plan"},defaultResult:{type:sequelize_1.DataTypes.ENUM("WIN","LOSS","DRAW"),allowNull:!1,validate:{isIn:{args:[["WIN","LOSS","DRAW"]],msg:"defaultResult: Must be one of 'WIN', 'LOSS', 'DRAW'"}},comment:"Default outcome for this plan (WIN, LOSS, DRAW)"},trending:{type:sequelize_1.DataTypes.BOOLEAN,allowNull:!0,defaultValue:!1,validate:{isBoolean:{msg:"trending: Trending must be a boolean value"}},comment:"Indicates if this plan is currently trending or popular"},status:{type:sequelize_1.DataTypes.BOOLEAN,allowNull:!1,defaultValue:!0,validate:{isBoolean:{msg:"status: Status must be a boolean value"}},comment:"Indicates if this investment plan is active or inactive"}},{sequelize:e,modelName:"investmentPlan",tableName:"investment_plan",timestamps:!0,paranoid:!0,indexes:[{name:"PRIMARY",unique:!0,using:"BTREE",fields:[{name:"id"}]},{name:"investmentPlanNameKey",unique:!0,using:"BTREE",fields:[{name:"name"}]}]})}static associate(e){investmentPlan.hasMany(e.investment,{as:"investments",foreignKey:"planId",onDelete:"CASCADE",onUpdate:"CASCADE"});investmentPlan.hasMany(e.investmentPlanDuration,{as:"planDurations",foreignKey:"planId",onDelete:"CASCADE",onUpdate:"CASCADE"});investmentPlan.belongsToMany(e.investmentDuration,{through:e.investmentPlanDuration,as:"durations",foreignKey:"planId",otherKey:"durationId",onDelete:"CASCADE",onUpdate:"CASCADE"})}}exports.default=investmentPlan;