"use strict";function deepMerge(e,t){const r={...e};for(const s of Object.keys(t))t[s]&&"object"==typeof t[s]&&!Array.isArray(t[s])?r[s]=deepMerge(e[s]||{},t[s]):r[s]=t[s];return r}Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),query_1=require("@b/utils/query");exports.metadata={summary:"Get Trading admin settings",operationId:"getTradingAdminSettings",tags:["Admin","Trading"],responses:{200:{description:"Trading settings",content:{"application/json":{schema:{type:"object"}}}},401:query_1.unauthorizedResponse,500:query_1.serverErrorResponse},requiresAuth:!0,permission:"access.trading.settings"};const DEFAULT_SETTINGS={chartProvider:"tradingview",defaultLayout:"pro",features:{analytics:!0,hotkeys:!0,advancedOrders:!0,oneClickTrading:!1,depthChart:!0,recentTrades:!0,positionsPanel:!0,ordersPanel:!0,marketsPanel:!0},layouts:{allowCustomLayouts:!0,maxSavedLayouts:5,defaultPanels:["chart","orderbook","trades","form"]},hotkeys:{enabled:!0,allowCustomization:!0,defaults:{buy:"B",sell:"S",cancel:"Escape",focusPrice:"P",focusAmount:"A"}},analytics:{enabled:!0,retentionDays:90,showPnLChart:!0,showWinRate:!0,showTradeDistribution:!0,showPerformanceMetrics:!0},trading:{confirmOrders:!0,showEstimatedFees:!0,showOrderPreview:!0,defaultOrderType:"limit",quickAmountPercentages:[25,50,75,100]},mobile:{enabled:!0,showQuickTradeFab:!0,enableSwipeGestures:!0,hapticFeedback:!0},display:{compactMode:!1,showSpread:!0,showVolume:!0,priceDecimals:2,amountDecimals:6,theme:"system"}};exports.default=async()=>{const e=await db_1.models.settings.findOne({where:{key:"trading_pro"}});if(!(null==e?void 0:e.value))return DEFAULT_SETTINGS;try{const t=JSON.parse(e.value);return deepMerge(DEFAULT_SETTINGS,t)}catch(e){return DEFAULT_SETTINGS}};