{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:observability-contract-matrix-v1",
  "title": "AWOOOI 監控合約與降噪機會矩陣 v1",
  "description": "以 repo 內 committed Prometheus / Alertmanager / Grafana / SigNoz / ClickHouse / Sentry evidence 建立只讀 observability matrix；不修改 alert rules、不發通知、不打 silence API、不部署 exporter、不觸發 workflow。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "rollups",
    "observability_surfaces",
    "noise_reduction_opportunities",
    "classification_gaps",
    "latest_observations",
    "operator_contract",
    "operation_boundaries",
    "approval_boundaries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "observability_contract_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
    },
    "observability_surfaces": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "surface_id",
          "display_name",
          "kind",
          "status",
          "risk_level",
          "evidence_status",
          "noise_policy_status",
          "coverage_contract",
          "evidence_refs",
          "next_action"
        ],
        "additionalProperties": true
      }
    },
    "noise_reduction_opportunities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "opportunity_id",
          "display_name",
          "status",
          "proposal_only",
          "impact",
          "evidence_refs",
          "next_action"
        ],
        "additionalProperties": true
      }
    },
    "classification_gaps": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "gap_id",
          "display_name",
          "status",
          "severity",
          "summary",
          "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
}
