"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const query_1=require("@b/utils/query"),error_1=require("@b/utils/error"),db_1=require("@b/db"),utils_1=require("../../utils");exports.metadata={summary:"Retrieves a single investment plan by ID",description:"Fetches detailed information about a specific investment plan based on its unique identifier.",operationId:"getInvestmentPlan",tags:["Finance","Investment"],parameters:[{index:0,name:"id",in:"path",required:!0,description:"The ID of the investment plan to retrieve",schema:{type:"number"}}],responses:{200:{description:"Investment plan retrieved successfully",content:{"application/json":{schema:{type:"object",properties:utils_1.baseInvestmentPlanSchema}}}},401:query_1.unauthorizedResponse,404:(0,query_1.notFoundMetadataResponse)("Investment Plan"),500:query_1.serverErrorResponse},requiresAuth:!1};exports.default=async e=>{const t=await db_1.models.investmentPlan.findOne({where:{id:e.params.id},include:[{model:db_1.models.investmentDuration,as:"durations",attributes:["id","duration","timeframe"],through:{attributes:[]}}],attributes:["id","title","description","image","minAmount","maxAmount","profitPercentage","currency","walletType","trending"]});if(!t)throw(0,error_1.createError)(404,"Investment plan not found");return t.get({plain:!0})};