{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-area-tree-response-schema.json",
  "title": "AreaTreeResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-areas-api-openapi.yml#/components/schemas/AreaTreeResponse",
  "properties": {
    "root": {
      "$ref": "#/$defs/AreaNode"
    },
    "depth": {
      "type": "integer",
      "title": "Depth"
    },
    "nodes": {
      "items": {
        "$ref": "#/$defs/AreaNode"
      },
      "type": "array",
      "title": "Nodes"
    },
    "delta_window": {
      "$ref": "#/$defs/AreaDeltaWindow"
    },
    "held": {
      "anyOf": [
        {
          "$ref": "#/$defs/AreaHeld"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "root",
    "depth",
    "nodes",
    "delta_window"
  ],
  "$defs": {
    "AreaBandCounts": {
      "properties": {
        "at_risk": {
          "type": "integer",
          "title": "At Risk"
        },
        "needs_work": {
          "type": "integer",
          "title": "Needs Work"
        },
        "fair": {
          "type": "integer",
          "title": "Fair"
        },
        "good": {
          "type": "integer",
          "title": "Good"
        },
        "excellent": {
          "type": "integer",
          "title": "Excellent"
        }
      },
      "type": "object",
      "required": [
        "at_risk",
        "needs_work",
        "fair",
        "good",
        "excellent"
      ],
      "title": "AreaBandCounts"
    },
    "AreaDeltaWindow": {
      "properties": {
        "target_days": {
          "type": "integer",
          "title": "Target Days"
        },
        "latest_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest At"
        },
        "baseline_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Baseline At"
        }
      },
      "type": "object",
      "required": [
        "target_days",
        "latest_at",
        "baseline_at"
      ],
      "title": "AreaDeltaWindow",
      "description": "The snapshots behind ``health_delta_30d``; the baseline may be nearer than 30 days."
    },
    "AreaHeld": {
      "properties": {
        "default": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Default"
        },
        "excluded": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Excluded"
        },
        "counts": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Counts"
        }
      },
      "type": "object",
      "required": [
        "default",
        "excluded",
        "counts"
      ],
      "title": "AreaHeld",
      "description": "The origins the map holds out by default, and what this answer left out."
    },
    "AreaNode": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "depth": {
          "type": "integer",
          "title": "Depth"
        },
        "parent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Parent"
        },
        "has_children": {
          "type": "boolean",
          "title": "Has Children"
        },
        "direct_file_count": {
          "type": "integer",
          "title": "Direct File Count"
        },
        "file_count": {
          "type": "integer",
          "title": "File Count"
        },
        "nloc": {
          "type": "integer",
          "title": "Nloc"
        },
        "health": {
          "type": "number",
          "title": "Health"
        },
        "band": {
          "type": "string",
          "enum": [
            "at_risk",
            "needs_work",
            "fair",
            "good",
            "excellent"
          ],
          "title": "Band"
        },
        "band_counts": {
          "$ref": "#/$defs/AreaBandCounts"
        },
        "worst_file": {
          "$ref": "#/$defs/AreaWorstFile"
        },
        "hotspot_count": {
          "type": "integer",
          "title": "Hotspot Count"
        },
        "bus_factor_1_count": {
          "type": "integer",
          "title": "Bus Factor 1 Count"
        },
        "primary_owner": {
          "anyOf": [
            {
              "$ref": "#/$defs/AreaOwner"
            },
            {
              "type": "null"
            }
          ]
        },
        "line_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line Coverage Pct"
        },
        "coverage_file_count": {
          "type": "integer",
          "title": "Coverage File Count"
        },
        "findings": {
          "$ref": "#/$defs/AreaSeverityCounts"
        },
        "health_delta_30d": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Health Delta 30D"
        }
      },
      "type": "object",
      "required": [
        "path",
        "name",
        "depth",
        "parent",
        "has_children",
        "direct_file_count",
        "file_count",
        "nloc",
        "health",
        "band",
        "band_counts",
        "worst_file",
        "hotspot_count",
        "bus_factor_1_count",
        "primary_owner",
        "line_coverage_pct",
        "coverage_file_count",
        "findings",
        "health_delta_30d"
      ],
      "title": "AreaNode"
    },
    "AreaOwner": {
      "properties": {
        "key": {
          "type": "string",
          "title": "Key"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "kind": {
          "type": "string",
          "enum": [
            "human",
            "agent",
            "bot"
          ],
          "title": "Kind"
        },
        "files": {
          "type": "integer",
          "title": "Files"
        },
        "share": {
          "type": "number",
          "title": "Share"
        }
      },
      "type": "object",
      "required": [
        "key",
        "name",
        "kind",
        "files",
        "share"
      ],
      "title": "AreaOwner"
    },
    "AreaSeverityCounts": {
      "properties": {
        "critical": {
          "type": "integer",
          "title": "Critical"
        },
        "high": {
          "type": "integer",
          "title": "High"
        },
        "medium": {
          "type": "integer",
          "title": "Medium"
        },
        "low": {
          "type": "integer",
          "title": "Low"
        }
      },
      "type": "object",
      "required": [
        "critical",
        "high",
        "medium",
        "low"
      ],
      "title": "AreaSeverityCounts"
    },
    "AreaWorstFile": {
      "properties": {
        "path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Path"
        },
        "score": {
          "type": "number",
          "title": "Score"
        }
      },
      "type": "object",
      "required": [
        "path",
        "score"
      ],
      "title": "AreaWorstFile"
    }
  }
}