"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('notes_delete_link', {
        description: 'Delete a directed relation between a note and another note or a cross-graph target. ' +
            'Set targetGraph to "docs", "code", "files", or "tasks" when deleting a cross-graph link.',
        inputSchema: {
            fromId: zod_1.z.string().min(1).max(500).describe('Source note ID'),
            toId: zod_1.z.string().min(1).max(500).describe('Target note ID, or target node ID in docs/code/files/tasks graph'),
            targetGraph: zod_1.z.enum(['docs', 'code', 'files', 'tasks', 'skills']).optional()
                .describe('Set to "docs", "code", "files", "tasks", or "skills" when deleting a cross-graph link'),
            projectId: zod_1.z.string().max(defaults_1.MAX_PROJECT_ID_LEN).optional().describe('Project ID that the target node belongs to. Defaults to the current project.'),
        },
    }, async ({ fromId, toId, targetGraph, projectId }) => {
        const deleted = mgr.deleteRelation(fromId, toId, targetGraph, projectId);
        if (!deleted) {
            return { content: [{ type: 'text', text: 'Relation not found.' }], isError: true };
        }
        return { content: [{ type: 'text', text: JSON.stringify({ fromId, toId, targetGraph, deleted: true }, null, 2) }] };
    });
}
