"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const query_1=require("@b/utils/query"),utils_1=require("./utils");exports.metadata={summary:"Stores a new Investment",operationId:"storeInvestment",tags:["Admin","Investments"],requestBody:{required:!0,content:{"application/json":{schema:utils_1.investmentUpdateSchema}}},responses:(0,query_1.storeRecordResponses)(utils_1.investmentStoreSchema,"Investment"),requiresAuth:!0,permission:"create.investment",logModule:"ADMIN_FIN",logTitle:"Create Investment History"};exports.default=async e=>{const{body:t,ctx:s}=e,{userId:n,planId:r,durationId:a,amount:o,profit:u,result:i,status:d,endDate:l}=t;null==s||s.step("Validating investment data");null==s||s.step("Creating new investment record");const m=await(0,query_1.storeRecord)({model:"investment",data:{userId:n,planId:r,durationId:a,amount:o,profit:u,result:i,status:d,endDate:l}});null==s||s.success();return m};