"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = starsRoutes;
async function starsRoutes(app, opts) {
    const { starsManager } = opts;
    // GET /characters/:id/stars — Stars earnings stats
    app.get('/characters/:id/stars', async (request, reply) => {
        const { id } = request.params;
        const { period } = request.query;
        try {
            const revenue = await starsManager.getRevenue(id, period);
            return reply.status(200).send({ success: true, data: revenue });
        }
        catch (err) {
            return reply.status(500).send({ success: false, error: err.message });
        }
    });
    // GET /characters/:id/stars/transactions — Transaction history
    app.get('/characters/:id/stars/transactions', async (request, reply) => {
        const { id } = request.params;
        const { type, status, limit, offset } = request.query;
        try {
            const transactions = await starsManager.getTransactions(id, {
                type,
                status,
                limit: limit ? Number(limit) : undefined,
                offset: offset ? Number(offset) : undefined,
            });
            return reply.status(200).send({ success: true, data: transactions });
        }
        catch (err) {
            return reply.status(500).send({ success: false, error: err.message });
        }
    });
}
//# sourceMappingURL=stars.js.map