"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
const defaults_1 = require("../../../lib/defaults");
function register(server, mgr) {
    server.registerTool('epics_list', {
        description: 'List epics with optional filters. Each epic includes progress (done/total tasks).',
        inputSchema: {
            status: zod_1.z.enum(['open', 'in_progress', 'done', 'cancelled']).optional().describe('Filter by status'),
            priority: zod_1.z.enum(['critical', 'high', 'medium', 'low']).optional().describe('Filter by priority'),
            tag: zod_1.z.string().max(defaults_1.MAX_TAG_LEN).optional().describe('Filter by tag'),
            limit: zod_1.z.number().int().positive().max(500).optional().describe('Max results'),
            offset: zod_1.z.number().int().min(0).max(100_000).optional().describe('Offset for pagination (default 0)'),
        },
    }, async ({ status, priority, tag, limit, offset }) => {
        const { results: epics, total } = mgr.listEpics({ status, priority, tag, limit, offset });
        return { content: [{ type: 'text', text: JSON.stringify({ results: epics, total }, null, 2) }] };
    });
}
