"use strict";async function getKycLevelById(e){const t=await db_1.models.kycLevel.findOne({where:{id:e,status:"ACTIVE"}});if(!t)throw(0,error_1.createError)({statusCode:404,message:"No active KYC level found"});return t.get({plain:!0})}Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;exports.getKycLevelById=getKycLevelById;const error_1=require("@b/utils/error"),db_1=require("@b/db"),query_1=require("@b/utils/query");exports.metadata={summary:"Fetch a specific active KYC level by ID",description:"Fetches an active KYC (Know Your Customer) level by its ID. This endpoint requires authentication.",operationId:"getKycLevelById",tags:["KYC"],logModule:"USER",logTitle:"Get KYC level",parameters:[{index:0,name:"id",in:"path",description:"The ID of the KYC level to retrieve",required:!0,schema:{type:"string"}}],responses:{200:{description:"KYC level retrieved successfully",content:{"application/json":{schema:{type:"object",properties:{id:{type:"number",description:"Level ID"},title:{type:"string",description:"Level title"},options:{type:"object",description:"Level options as JSON object",nullable:!0},status:{type:"boolean",description:"Active status of the level"}}}}}},401:query_1.unauthorizedResponse,404:(0,query_1.notFoundMetadataResponse)("KYC Level"),500:query_1.serverErrorResponse},requiresAuth:!0};exports.default=async e=>{const{user:t,params:r,ctx:s}=e;if(!(null==t?void 0:t.id)){null==s||s.fail("User not authenticated");throw(0,error_1.createError)({statusCode:401,message:"Unauthorized"})}const{id:i}=r;null==s||s.step("Retrieving KYC level");const o=await getKycLevelById(i);null==s||s.success("KYC level retrieved successfully");return o};