"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),error_1=require("@b/utils/error");exports.metadata={summary:"Delete a KYC Level",description:"Deletes a KYC level by its ID.",operationId:"deleteKycLevel",tags:["KYC","Levels"],parameters:[{index:0,name:"id",in:"path",description:"KYC level ID",required:!0,schema:{type:"string"}}],responses:{200:{description:"KYC level deleted successfully.",content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}}},404:{description:"KYC level not found."},500:{description:"Internal Server Error."}},permission:"delete.kyc.level",requiresAuth:!0,logModule:"ADMIN_CRM",logTitle:"Delete KYC level"};exports.default=async e=>{const{params:t,ctx:s}=e,{id:r}=t;if(!r)throw(0,error_1.createError)({statusCode:400,message:"Missing level ID"});null==s||s.step(`Fetching KYC level ${r}`);const l=await db_1.models.kycLevel.findByPk(r);if(!l)throw(0,error_1.createError)({statusCode:404,message:"KYC level not found"});null==s||s.step("Deleting KYC level");await l.destroy();null==s||s.success("KYC level deleted successfully");return{message:"KYC level deleted successfully."}};