import { getActivitiesByDate, getDailySummary, getRecentActivities, } from '../services/activity-service.js';
export async function activityRoutes(app, opts) {
    const { db } = opts;
    // GET /api/activities?date=2026-03-14&squad=design-system
    app.get('/api/activities', {
        preHandler: [app.requireAuth],
    }, async (request, reply) => {
        const date = request.query.date ?? new Date().toISOString().slice(0, 10);
        const squad = request.query.squad;
        if (squad) {
            const activities = getActivitiesByDate(db, date, squad);
            return reply.send({ data: activities });
        }
        const activities = getActivitiesByDate(db, date);
        return reply.send({ data: activities });
    });
    // GET /api/activities/summary?date=2026-03-14
    app.get('/api/activities/summary', {
        preHandler: [app.requireAuth],
    }, async (request, reply) => {
        const date = request.query.date ?? new Date().toISOString().slice(0, 10);
        const summaries = getDailySummary(db, date);
        return reply.send({ date, summaries });
    });
    // GET /api/activities/recent?limit=20
    app.get('/api/activities/recent', {
        preHandler: [app.requireAuth],
    }, async (request, reply) => {
        const limit = Math.min(parseInt(request.query.limit ?? '20', 10) || 20, 100);
        const activities = getRecentActivities(db, limit);
        return reply.send({ data: activities });
    });
}
//# sourceMappingURL=activity-routes.js.map