"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
function register(server, mgr) {
    server.registerTool('tasks_reorder', {
        description: 'Reorder a task within its status column. Optionally move to a different status at the same time. ' +
            'The order field is an integer — lower values appear first. ' +
            'Returns the updated task summary.',
        inputSchema: {
            taskId: zod_1.z.string().min(1).max(500).describe('Task ID to reorder'),
            order: zod_1.z.number().int().describe('New order position (integer, lower = higher in list)'),
            status: zod_1.z.enum(['backlog', 'todo', 'in_progress', 'review', 'done', 'cancelled']).optional()
                .describe('Optionally move to a different status at the same time'),
        },
    }, async ({ taskId, order, status }) => {
        const ok = mgr.reorderTask(taskId, order, status);
        if (!ok) {
            return { content: [{ type: 'text', text: 'Task not found' }], isError: true };
        }
        const task = mgr.getTask(taskId);
        return { content: [{ type: 'text', text: JSON.stringify({
                        taskId: task.id,
                        status: task.status,
                        order: task.order,
                    }, null, 2) }] };
    });
}
