{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/BourbonDog/amicus/main/schemas/doctor.schema.json",
  "title": "amicus doctor document",
  "description": "`doctor --json` health-check result.",
  "type": "object",
  "required": ["schemaVersion", "type", "ok", "version", "timestamp", "checks"],
  "properties": {
    "schemaVersion": { "const": 2 },
    "type": { "const": "doctor" },
    "ok": { "type": "boolean" },
    "version": { "type": "string" },
    "timestamp": { "type": "string" },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "status"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "status": { "type": "string" },
          "message": { "type": ["string", "null"] },
          "hint": { "type": ["string", "null"] },
          "fixed": { "type": "boolean" },
          "fixDetail": { "type": "string" }
        }
      }
    },
    "degrades": {
      "description": "v4.6 Plan 3: failed checks and --fix repairs in the shared degrade/heal vocabulary — additive, absent when clean.",
      "type": "array",
      "items": {
        "type": "object",
        "required": ["kind", "channel", "what", "why", "effect"],
        "properties": {
          "kind": { "enum": ["degrade", "heal"] },
          "channel": { "type": "string" },
          "what": { "type": "string" },
          "why": { "type": "string" },
          "effect": { "type": "string" },
          "remedy": { "type": "string" },
          "data": {
            "type": "object",
            "description": "v4.6 Plan 3: optional structured facts for derivations (doctor: {checkId}). Prose fields stay the human surface."
          }
        }
      }
    }
  }
}
