"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const exchange_1=__importDefault(require("@b/utils/exchange")),query_1=require("@b/utils/query"),utils_1=require("../utils"),db_1=require("@b/db");exports.metadata={summary:"Retrieves detailed information of a specific exchange by ID",operationId:"getExchangeById",tags:["Admin","Exchanges"],parameters:[{index:0,name:"productId",in:"path",required:!0,description:"ID of the exchange to retrieve",schema:{type:"string"}}],responses:{200:{description:"Exchange details",content:{"application/json":{schema:{type:"object",properties:utils_1.baseExchangeSchema}}}},401:query_1.unauthorizedResponse,404:(0,query_1.notFoundMetadataResponse)("Exchange"),500:query_1.serverErrorResponse},permission:"view.exchange",requiresAuth:!0};exports.default=async e=>{const{params:t,ctx:r}=e,{productId:a}=t,n=await db_1.models.exchange.findOne({where:{productId:a}});if(!n)return e.response.notFound("Exchange not found");return{exchange:n,result:await exchange_1.default.testExchangeCredentials(n.name,r)}};