{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aiosforge.dev/schemas/parallel-doctor.schema.json",
  "title": "AIOSON parallel:doctor --json output",
  "type": "object",
  "required": ["ok", "targetDir", "workers", "fix", "state", "checks", "summary"],
  "properties": {
    "ok": { "type": "boolean" },
    "targetDir": { "type": "string" },
    "workers": { "type": "integer", "minimum": 2, "maximum": 6 },
    "fix": {
      "type": "object",
      "required": ["enabled", "dryRun", "force"],
      "properties": {
        "enabled": { "type": "boolean" },
        "dryRun": { "type": "boolean" },
        "force": { "type": "boolean" },
        "changedCount": { "type": "integer", "minimum": 0 },
        "actions": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id", "applied", "count"],
            "properties": {
              "id": { "type": "string" },
              "applied": { "type": "boolean" },
              "skipped": { "type": "boolean" },
              "count": { "type": "integer", "minimum": 0 }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "state": {
      "type": "object",
      "required": ["parallelDir", "dirExists", "sharedExists", "laneFiles", "laneIndices", "missingLaneIndices"],
      "properties": {
        "parallelDir": { "type": "string" },
        "dirExists": { "type": "boolean" },
        "sharedExists": { "type": "boolean" },
        "manifestExists": { "type": "boolean" },
        "ownershipExists": { "type": "boolean" },
        "mergePlanExists": { "type": "boolean" },
        "laneFiles": {
          "type": "array",
          "items": { "type": "string" }
        },
        "laneIndices": {
          "type": "array",
          "items": { "type": "integer", "minimum": 1 }
        },
        "missingLaneIndices": {
          "type": "array",
          "items": { "type": "integer", "minimum": 1 }
        }
      },
      "additionalProperties": true
    },
    "analysis": {
      "type": "object",
      "properties": {
        "ownershipConflicts": {
          "type": "array",
          "items": { "type": "object", "additionalProperties": true }
        },
        "dependencies": {
          "type": "object",
          "properties": {
            "declaredCount": { "type": "integer", "minimum": 0 },
            "invalidCount": { "type": "integer", "minimum": 0 },
            "blockedCount": { "type": "integer", "minimum": 0 },
            "orderViolationCount": { "type": "integer", "minimum": 0 }
          },
          "additionalProperties": true
        },
        "sync": {
          "type": "object",
          "properties": {
            "workspaceManifestInSync": { "type": "boolean" },
            "ownershipMapInSync": { "type": "boolean" },
            "mergePlanInSync": { "type": "boolean" },
            "staleFiles": {
              "type": "array",
              "items": { "type": "string" }
            }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "ok", "severity", "message", "hint"],
        "properties": {
          "id": { "type": "string" },
          "ok": { "type": "boolean" },
          "severity": { "type": "string", "enum": ["info", "warn", "error"] },
          "message": { "type": "string" },
          "hint": { "type": "string" }
        },
        "additionalProperties": true
      }
    },
    "summary": {
      "type": "object",
      "required": ["total", "passed", "failed", "warnings"],
      "properties": {
        "total": { "type": "integer", "minimum": 0 },
        "passed": { "type": "integer", "minimum": 0 },
        "failed": { "type": "integer", "minimum": 0 },
        "warnings": { "type": "integer", "minimum": 0 }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
