import { z } from 'zod';
import { safeTracked } from './safe-handler.js';
import { TrashActionEnum } from './schemas/index.js';
import { handleDeleteSpec } from './delete-spec.js';
import { handleDeleteProject } from './delete-project.js';
import { handleDeletePattern } from './delete-pattern.js';
import { handleDeleteDecision } from './delete-decision.js';
import { handleManageTrash } from './manage-trash.js';
/**
 * Registers all delete operation tools (SPEC-087) on the MCP server.
 */
export function registerDeleteTools(server) {
    server.registerTool('delete_spec', {
        description: 'Delete one or more specs from a project. Shows a preview by default — set confirm=true to execute. Soft delete (moves to trash) by default — set force=true for permanent deletion.',
        inputSchema: {
            projectRoot: z.string().max(4096).describe('Absolute path to the project root'),
            specId: z
                .union([z.string().max(500), z.array(z.string().max(500)).max(100)])
                .describe('Spec ID or array of spec IDs to delete'),
            confirm: z
                .boolean()
                .optional()
                .describe('Set to true to execute deletion. Without it, only a preview is shown.'),
            force: z
                .boolean()
                .optional()
                .describe('Set to true for permanent (hard) deletion. Default is soft delete (trash).'),
        },
        annotations: { title: 'Delete Spec', destructiveHint: true },
    }, safeTracked('delete_spec', async (args) => handleDeleteSpec(args)));
    server.registerTool('delete_project', {
        description: 'Delete all data for a project. Shows a preview by default — requires confirm=true to execute. Soft delete (moves to trash) by default — set force=true for permanent deletion.',
        inputSchema: {
            projectRoot: z.string().max(4096).describe('Absolute path to the project root'),
            confirm: z
                .boolean()
                .optional()
                .describe('Set to true to execute deletion. Without it, only a preview is shown.'),
            force: z
                .boolean()
                .optional()
                .describe('Set to true for permanent (hard) deletion. Default is soft delete (trash).'),
        },
        annotations: { title: 'Delete Project', destructiveHint: true },
    }, safeTracked('delete_project', async (args) => handleDeleteProject(args)));
    server.registerTool('delete_pattern', {
        description: 'Delete one or more learned patterns from a project. Shows a preview by default — set confirm=true to execute.',
        inputSchema: {
            projectRoot: z.string().max(4096).describe('Absolute path to the project root'),
            patternId: z
                .union([z.string().max(500), z.array(z.string().max(500)).max(100)])
                .describe('Pattern ID or array of pattern IDs to delete'),
            confirm: z
                .boolean()
                .optional()
                .describe('Set to true to execute deletion. Without it, only a preview is shown.'),
            force: z
                .boolean()
                .optional()
                .describe('Set to true for permanent (hard) deletion. Default is soft delete (trash).'),
        },
        annotations: { title: 'Delete Pattern', destructiveHint: true },
    }, safeTracked('delete_pattern', async (args) => handleDeletePattern(args)));
    server.registerTool('delete_decision', {
        description: 'Delete one or more decisions/ADRs from a project. Shows a preview by default — set confirm=true to execute.',
        inputSchema: {
            projectRoot: z.string().max(4096).describe('Absolute path to the project root'),
            decisionId: z
                .union([z.string().max(500), z.array(z.string().max(500)).max(100)])
                .describe('Decision ID or array of decision IDs to delete'),
            confirm: z
                .boolean()
                .optional()
                .describe('Set to true to execute deletion. Without it, only a preview is shown.'),
            force: z
                .boolean()
                .optional()
                .describe('Set to true for permanent (hard) deletion. Default is soft delete (trash).'),
        },
        annotations: { title: 'Delete Decision', destructiveHint: true },
    }, safeTracked('delete_decision', async (args) => handleDeleteDecision(args)));
    server.registerTool('manage_trash', {
        description: 'Manage the trash for a project. Actions: list (show trashed items), restore (restore an item from trash), purge (permanently delete trash items).',
        inputSchema: {
            projectRoot: z.string().max(4096).describe('Absolute path to the project root'),
            action: TrashActionEnum.describe('Action to perform: list | restore | purge'),
            itemId: z
                .string()
                .max(500)
                .optional()
                .describe('Trash item ID — required for restore, optional for purge (omit to purge all)'),
        },
        annotations: { title: 'Manage Trash', destructiveHint: true },
    }, safeTracked('manage_trash', async (args) => handleManageTrash(args)));
}
//# sourceMappingURL=register-delete-tools.js.map