{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/doctor-report.schema.json",
  "title": "Doctor report",
  "description": "What `doctor.mjs --json` prints. schemaVersion changes only when an existing field changes meaning or shape; a new check id or a new optional field does not change it. Every check id is listed by `doctor.mjs --list-checks` and documented in multi-agent-refs/features/doctor.md. `exit` is the process exit code: 0 healthy, 1 at least one WARN, 2 at least one BLOCK, 4 indeterminate (the layout did not resolve).",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "exit", "selection", "checks"],
  "properties": {
    "schemaVersion": { "const": 1, "x-sensitivity": "none" },
    "exit": { "type": "integer", "enum": [0, 1, 2, 4], "x-sensitivity": "none" },
    "selection": {
      "description": "The check ids --only asked for, in the order given, or null for a full run.",
      "anyOf": [
        { "type": "null" },
        { "type": "array", "items": { "type": "string", "pattern": "^[a-z0-9-]+$" } }
      ],
      "x-sensitivity": "none"
    },
    "checks": {
      "description": "One entry per check that ran, in registry order.",
      "type": "array",
      "x-sensitivity": "local",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "severity", "problem", "step", "detail"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "severity": { "type": "string", "enum": ["OK", "INFO", "WARN", "BLOCK", "SKIP"] },
          "problem": {
            "description": "What is wrong (WARN, BLOCK, INFO) or why it was not checked (SKIP); null for OK.",
            "type": ["string", "null"]
          },
          "step": {
            "description": "The single step that fixes it, starting with a verb from the closed list; null for OK and SKIP.",
            "type": ["string", "null"]
          },
          "detail": {
            "description": "What --explain prints: a string, a list, or null. Free-form per check.",
            "type": ["string", "array", "object", "null"]
          }
        }
      }
    }
  }
}
