"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),error_1=require("@b/utils/error"),console_1=require("@b/utils/console");exports.metadata={summary:"Get deposit transaction by ID",operationId:"getDepositTransactionById",tags:["Admin","Finance","Deposits"],parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"},description:"Deposit transaction ID"}],responses:{200:{description:"Deposit transaction details",content:{"application/json":{schema:{type:"object",properties:{id:{type:"string"},userId:{type:"string"},walletId:{type:"string"},amount:{type:"number"},fee:{type:"number"},description:{type:"string"},status:{type:"string"},referenceId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},user:{type:"object",properties:{firstName:{type:"string"},lastName:{type:"string"},email:{type:"string"},avatar:{type:"string"}}},wallet:{type:"object",properties:{currency:{type:"string"},type:{type:"string"}}}}}}}},404:{description:"Deposit transaction not found"}},requiresAuth:!0,permission:"view.deposit",demoMask:["user.email"]};exports.default=async e=>{const{params:t,user:r}=e,{id:s}=t;if(!r)throw(0,error_1.createError)({statusCode:401,message:"Unauthorized"});try{const e=await db_1.models.transaction.findOne({where:{id:s,type:"DEPOSIT"},include:[{model:db_1.models.user,as:"user",attributes:["id","firstName","lastName","email","avatar"]},{model:db_1.models.wallet,as:"wallet",attributes:["id","currency","type"]}]});if(!e)throw(0,error_1.createError)({statusCode:404,message:"Deposit transaction not found"});return{...e.get({plain:!0})}}catch(e){console_1.logger.error("DEPOSIT","Error fetching deposit transaction",e);throw(0,error_1.createError)({statusCode:500,message:e.message||"Internal server error"})}};