"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const notification_1=require("@b/services/notification"),errors_1=require("@b/utils/schema/errors");exports.metadata={summary:"Get Queue Statistics",description:"Retrieve statistics about the notification email queue",operationId:"getQueueStatistics",tags:["Admin","Notification","Queue"],requiresAuth:!0,permission:"access.notification.settings",responses:{200:{description:"Queue statistics retrieved successfully",content:{"application/json":{schema:{type:"object",properties:{waiting:{type:"number"},active:{type:"number"},completed:{type:"number"},failed:{type:"number"},delayed:{type:"number"},paused:{type:"boolean"}}}}}},401:errors_1.unauthorizedResponse,500:errors_1.serverErrorResponse}};exports.default=async e=>{var t,i,a;const{ctx:s}=e;try{null===(t=null==s?void 0:s.step)||void 0===t||t.call(s,"Fetching queue statistics");const e=await notification_1.notificationQueue.getStats();null===(i=null==s?void 0:s.success)||void 0===i||i.call(s,"Queue statistics retrieved");return{timestamp:(new Date).toISOString(),queue:{waiting:e.waiting,active:e.active,completed:e.completed,failed:e.failed,delayed:e.delayed},health:{status:e.failed>.1*e.completed?"degraded":"healthy",totalJobs:e.waiting+e.active+e.completed+e.failed,failureRate:e.completed>0?(e.failed/(e.completed+e.failed)*100).toFixed(2):"0.00"}}}catch(e){null===(a=null==s?void 0:s.fail)||void 0===a||a.call(s,e.message);throw e}};