"use strict";async function checkSumSubEnv(){const e={SUMSUB_API_KEY:process.env.SUMSUB_API_KEY,SUMSUB_API_SECRET:process.env.SUMSUB_API_SECRET},r=Object.entries(e).filter(([e,r])=>!r).map(([e])=>e);return r.length>0?{success:!1,missingEnvVars:r}:{success:!0,missingEnvVars:[]}}async function checkGeminiEnv(){const e={GEMINI_API_KEY:process.env.GEMINI_API_KEY},r=Object.entries(e).filter(([e,r])=>!r).map(([e])=>e);return r.length>0?{success:!1,missingEnvVars:r}:{success:!0,missingEnvVars:[]}}async function checkDeepSeekEnv(){const e={DEEPSEEK_API_KEY:process.env.DEEPSEEK_API_KEY},r=Object.entries(e).filter(([e,r])=>!r).map(([e])=>e);return r.length>0?{success:!1,missingEnvVars:r}:{success:!0,missingEnvVars:[]}}Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const error_1=require("@b/utils/error"),console_1=require("@b/utils/console");exports.metadata={summary:"Check Verification Service Environment Variables",description:"Checks if the required environment variables for a verification service are configured.",operationId:"checkVerificationServiceEnv",tags:["KYC","Verification Services"],logModule:"ADMIN_CRM",logTitle:"Check verification service env",parameters:[{index:0,name:"id",in:"path",description:"Verification service ID",required:!0,schema:{type:"string"}}],responses:{200:{description:"Environment variable check completed.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether all required environment variables are present"},missingEnvVars:{type:"array",items:{type:"string"},description:"List of missing environment variables"}}}}}},404:{description:"Verification service not found."},500:{description:"Internal Server Error."}}};exports.default=async e=>{const{params:r,ctx:s}=e;try{const{id:e}=r;null==s||s.step(`Checking environment variables for ${e}`);let i;if(e.startsWith("sumsub"))i=await checkSumSubEnv();else if(e.startsWith("gemini"))i=await checkGeminiEnv();else{if(!e.startsWith("deepseek"))throw(0,error_1.createError)({statusCode:404,message:"Verification service not found"});i=await checkDeepSeekEnv()}i.success?null==s||s.success("Environment variables configured correctly"):null==s||s.warn(`Missing environment variables: ${i.missingEnvVars.join(", ")}`);return i}catch(e){null==s||s.fail("Failed to check environment variables");console_1.logger.error("KYC","Error in checkVerificationServiceEnv",e);throw(0,error_1.createError)({statusCode:e.statusCode||500,message:e.message||"Failed to check environment variables for verification service"})}};