"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class p2pCommission extends sequelize_1.Model{static initModel(e){return p2pCommission.init({id:{type:sequelize_1.DataTypes.UUID,defaultValue:sequelize_1.DataTypes.UUIDV4,primaryKey:!0,allowNull:!1},adminId:{type:sequelize_1.DataTypes.UUID,allowNull:!1,validate:{notNull:{msg:"adminId cannot be null"},isUUID:{args:4,msg:"adminId must be a valid UUID"}}},amount:{type:sequelize_1.DataTypes.DOUBLE,allowNull:!1,validate:{isFloat:{msg:"amount must be a valid number"},min:{args:[0],msg:"amount cannot be negative"}}},description:{type:sequelize_1.DataTypes.TEXT,allowNull:!0},tradeId:{type:sequelize_1.DataTypes.UUID,allowNull:!0,validate:{isUUID:{args:4,msg:"tradeId must be a valid UUID"}}},offerId:{type:sequelize_1.DataTypes.UUID,allowNull:!0,validate:{isUUID:{args:4,msg:"offerId must be a valid UUID"}}}},{sequelize:e,modelName:"p2pCommission",tableName:"p2p_commissions",timestamps:!0,paranoid:!0})}static associate(e){p2pCommission.belongsTo(e.user,{as:"admin",foreignKey:"adminId",onDelete:"CASCADE",onUpdate:"CASCADE"});e.p2pTrade&&p2pCommission.belongsTo(e.p2pTrade,{as:"trade",foreignKey:"tradeId",onDelete:"SET NULL",onUpdate:"CASCADE"});e.p2pOffer&&p2pCommission.belongsTo(e.p2pOffer,{as:"offer",foreignKey:"offerId",onDelete:"SET NULL",onUpdate:"CASCADE"})}}exports.default=p2pCommission;