"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const sequelize_1=require("sequelize");class ecommerceOrderItem extends sequelize_1.Model{static initModel(e){return ecommerceOrderItem.init({id:{type:sequelize_1.DataTypes.UUID,defaultValue:sequelize_1.DataTypes.UUIDV4,primaryKey:!0,allowNull:!1},orderId:{type:sequelize_1.DataTypes.UUID,allowNull:!1,validate:{isUUID:{args:4,msg:"orderId: Order ID must be a valid UUID"}}},productId:{type:sequelize_1.DataTypes.UUID,allowNull:!1,validate:{isUUID:{args:4,msg:"productId: Product ID must be a valid UUID"}}},quantity:{type:sequelize_1.DataTypes.INTEGER,allowNull:!1,validate:{isInt:{msg:"quantity: Quantity must be an integer"},min:{args:[1],msg:"quantity: Quantity must be at least 1"}}},key:{type:sequelize_1.DataTypes.STRING(191),allowNull:!0},filePath:{type:sequelize_1.DataTypes.STRING(191),allowNull:!0},instructions:{type:sequelize_1.DataTypes.TEXT,allowNull:!0}},{sequelize:e,modelName:"ecommerceOrderItem",tableName:"ecommerce_order_item",timestamps:!1,indexes:[{name:"PRIMARY",unique:!0,using:"BTREE",fields:[{name:"id"}]},{name:"ecommerceOrderItemOrderIdProductIdKey",unique:!0,using:"BTREE",fields:[{name:"orderId"},{name:"productId"}]},{name:"ecommerceOrderItemProductIdFkey",using:"BTREE",fields:[{name:"productId"}]}]})}static associate(e){ecommerceOrderItem.belongsTo(e.ecommerceProduct,{as:"product",foreignKey:"productId",onDelete:"CASCADE",onUpdate:"CASCADE"});ecommerceOrderItem.belongsTo(e.ecommerceOrder,{as:"order",foreignKey:"orderId",onDelete:"CASCADE",onUpdate:"CASCADE"})}}exports.default=ecommerceOrderItem;