"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSupportDashboardController = createSupportDashboardController;
function createSupportDashboardController(ticketService, agentService, logger) {
    return {
        getDashboard: async (_req, res) => {
            try {
                const stats = await ticketService.getTicketStats();
                const onlineAgents = await agentService.listOnlineAgents();
                res.json({
                    success: true,
                    data: {
                        openTickets: stats.open,
                        waitingAgents: stats.waitingAgent,
                        activeTickets: stats.active,
                        resolvedToday: stats.resolvedToday,
                        closedToday: stats.closedToday,
                        onlineAgents: onlineAgents.length
                    }
                });
            }
            catch (error) {
                logger.error("Failed to get support dashboard.", { error: error instanceof Error ? error.message : String(error) });
                res.status(500).json({ success: false, error: "Failed to load dashboard." });
            }
        }
    };
}
