"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = analyticsRoutes;
async function analyticsRoutes(app, opts) {
    const { analyticsEngine } = opts;
    // GET /analytics/characters/:id — Character analytics
    app.get('/analytics/characters/:id', async (request, reply) => {
        const { id } = request.params;
        const { period, startDate, endDate } = request.query;
        try {
            const analytics = await analyticsEngine.getCharacterAnalytics(id, period || 'daily', startDate);
            return reply.status(200).send({ success: true, data: analytics });
        }
        catch (err) {
            return reply.status(500).send({ success: false, error: err.message });
        }
    });
    // GET /analytics/comparison — Character comparison
    app.get('/analytics/comparison', async (request, reply) => {
        const { characterIds, period } = request.query;
        try {
            const ids = characterIds ? characterIds.split(',') : [];
            if (ids.length === 0) {
                return reply.status(400).send({ success: false, error: 'characterIds query parameter is required (comma-separated)' });
            }
            const comparison = await analyticsEngine.compareCharacters(ids, period || 'daily');
            return reply.status(200).send({ success: true, data: comparison });
        }
        catch (err) {
            return reply.status(500).send({ success: false, error: err.message });
        }
    });
    // GET /analytics/overview — System overview
    app.get('/analytics/overview', async (_request, reply) => {
        try {
            const overview = await analyticsEngine.getSystemOverview();
            return reply.status(200).send({ success: true, data: overview });
        }
        catch (err) {
            return reply.status(500).send({ success: false, error: err.message });
        }
    });
}
//# sourceMappingURL=analytics.js.map