export default {
    id: "marcusgroup.legal-ai",
    apiVersion: 1,
    version: "0.1.0",
    displayName: "Ezer Mishpati - Legal AI",
    description: "Integration with legal decision drafting system — case management, semantic search, and workflow tracking",
    author: "Marcus Group",
    categories: ["connector"],
    capabilities: [
        "events.subscribe",
        "issues.read",
        "issues.create",
        "issues.update",
        "issue.comments.create",
        "agent.tools.register",
        "http.outbound",
        "plugin.state.read",
        "plugin.state.write",
        "jobs.schedule",
        "activity.log.write",
        "companies.read",
        "projects.read",
    ],
    entrypoints: {
        worker: "dist/worker.js",
    },
    instanceConfigSchema: {
        type: "object",
        properties: {
            legalApiBaseUrl: {
                type: "string",
                default: "http://localhost:8085",
                description: "Base URL for the Ezer Mishpati API",
            },
        },
    },
    tools: [
        {
            toolKey: "legal_case_list",
            name: "legal_case_list",
            displayName: "List Legal Cases",
            description: "List all appeal cases in the legal system",
            parametersSchema: { type: "object", properties: {} },
        },
        {
            toolKey: "legal_case_get",
            name: "legal_case_get",
            displayName: "Get Legal Case Details",
            description: "Get full details of a legal case including documents",
            parametersSchema: {
                type: "object",
                properties: {
                    case_number: { type: "string", description: "Case number" },
                },
                required: ["case_number"],
            },
        },
        {
            toolKey: "legal_case_create",
            name: "legal_case_create",
            displayName: "Create Legal Case",
            description: "Create a new appeal case with linked Paperclip issue",
            parametersSchema: {
                type: "object",
                properties: {
                    case_number: { type: "string" },
                    title: { type: "string" },
                    appellants: { type: "array", items: { type: "string" } },
                    respondents: { type: "array", items: { type: "string" } },
                    subject: { type: "string" },
                    property_address: { type: "string" },
                    expected_outcome: { type: "string" },
                },
                required: ["case_number", "title"],
            },
        },
        {
            toolKey: "legal_case_update",
            name: "legal_case_update",
            displayName: "Update Legal Case",
            description: "Update a legal case status, title, or outcome",
            parametersSchema: {
                type: "object",
                properties: {
                    case_number: { type: "string" },
                    status: { type: "string" },
                    title: { type: "string" },
                    expected_outcome: { type: "string" },
                },
                required: ["case_number"],
            },
        },
        {
            toolKey: "legal_case_status",
            name: "legal_case_status",
            displayName: "Get Case Workflow Status",
            description: "Get full workflow status: documents, drafts, next steps",
            parametersSchema: {
                type: "object",
                properties: {
                    case_number: { type: "string" },
                },
                required: ["case_number"],
            },
        },
        {
            toolKey: "legal_search",
            name: "legal_search",
            displayName: "Search Legal Precedents",
            description: "Semantic RAG search across previous decisions",
            parametersSchema: {
                type: "object",
                properties: {
                    query: { type: "string", description: "Search query in Hebrew" },
                    limit: { type: "number" },
                    section_type: { type: "string" },
                },
                required: ["query"],
            },
        },
        {
            toolKey: "legal_case_template",
            name: "legal_case_template",
            displayName: "Get Decision Template",
            description: "Get outcome-aware decision template for 12-block structure",
            parametersSchema: {
                type: "object",
                properties: {
                    case_number: { type: "string" },
                },
                required: ["case_number"],
            },
        },
        {
            toolKey: "legal_processing_status",
            name: "legal_processing_status",
            displayName: "Get Processing Status",
            description: "Get overall system processing status",
            parametersSchema: { type: "object", properties: {} },
        },
    ],
    jobs: [
        {
            jobKey: "sync-case-status",
            displayName: "Sync Legal Case Status",
            description: "Polls legal-ai for case status changes and updates Paperclip issues",
            schedule: "*/15 * * * *",
        },
    ],
};
