"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const cache_1=require("@b/utils/cache");exports.metadata={summary:"Force reload settings cache",description:"Clears the Redis cache and reloads all settings from the database",operationId:"reloadSettingsCache",tags:["Admin","Settings","Cache"],requiresAuth:!0,permission:"edit.settings",responses:{200:{description:"Cache reloaded successfully",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean"},message:{type:"string"},settingsCount:{type:"number"},extensionsCount:{type:"number"},settings:{type:"array",items:{type:"object",properties:{key:{type:"string"},value:{type:"string"}}}}}}}}},401:{description:"Unauthorized"},500:{description:"Internal server error"}}};exports.default=async e=>{var t,s,a;const{ctx:n}=e;try{null===(t=null==n?void 0:n.step)||void 0===t||t.call(n,"Force reloading settings cache from database");const e=cache_1.CacheManager.getInstance();await e.clearCache();const a=await e.getSettings(),r=await e.getExtensions(),i=Array.from(a.entries()).map(([e,t])=>({key:e,value:t}));null===(s=null==n?void 0:n.success)||void 0===s||s.call(n,`Cache reloaded. Loaded ${a.size} settings, ${r.size} extensions`);return{success:!0,message:"Cache cleared and reloaded from database",settingsCount:a.size,extensionsCount:r.size,settings:i}}catch(e){null===(a=null==n?void 0:n.fail)||void 0===a||a.call(n,e.message);throw e}};