{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:service-health-gap-matrix-v1",
  "title": "AWOOOI 服務健康缺口只讀矩陣 v1",
  "description": "以 repo 內 committed service endpoint、health check、K8s manifest、AI provider 與 observability evidence 建立服務健康缺口矩陣；不重啟服務、不改 endpoint、不做 active probe、不讀 secret payload、不送通知。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "rollups",
    "service_health_targets",
    "health_gaps",
    "stale_endpoints",
    "latest_observations",
    "operator_contract",
    "operation_boundaries",
    "approval_boundaries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "service_health_gap_matrix_v1"
    },
    "generated_at": {
      "type": "string",
      "minLength": 1
    },
    "program_status": {
      "type": "object",
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode"
      ],
      "properties": {
        "overall_completion_percent": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "current_priority": {
          "type": "string",
          "enum": [
            "P0",
            "P1",
            "P2",
            "P3"
          ]
        },
        "current_task_id": {
          "type": "string",
          "minLength": 1
        },
        "next_task_id": {
          "type": "string",
          "minLength": 1
        },
        "read_only_mode": {
          "type": "boolean",
          "const": true
        }
      },
      "additionalProperties": false
    },
    "source_refs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "rollups": {
      "type": "object",
      "additionalProperties": true
    },
    "service_health_targets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "target_id",
          "display_name",
          "kind",
          "status",
          "risk_level",
          "freshness_status",
          "health_contract",
          "endpoint_contract",
          "evidence_refs",
          "next_action"
        ],
        "additionalProperties": true
      }
    },
    "health_gaps": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "gap_id",
          "display_name",
          "status",
          "severity",
          "summary",
          "target_ids",
          "evidence_refs",
          "next_action"
        ],
        "additionalProperties": true
      }
    },
    "stale_endpoints": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "endpoint_id",
          "display_name",
          "status",
          "severity",
          "stale_ref",
          "current_truth",
          "evidence_refs",
          "next_action"
        ],
        "additionalProperties": true
      }
    },
    "latest_observations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "operator_contract": {
      "type": "object",
      "additionalProperties": true
    },
    "operation_boundaries": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "approval_boundaries": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean",
        "const": false
      }
    }
  },
  "additionalProperties": false
}
