{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:kali-integration-status-v1",
  "title": "AWOOOI Kali Integration Status (v1)",
  "description": "記錄 192.168.0.112 Kali 主機與 AWOOOI/AwoooP 資安網的整合狀態、低風險更新、缺口與禁止動作。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "date",
    "host",
    "mode",
    "live_checks",
    "updates_applied",
    "integration_state",
    "risk_register",
    "next_gates",
    "still_forbidden"
  ],
  "properties": {
    "schema_version": {
      "const": "kali_integration_status_v1"
    },
    "status": {
      "type": "string",
      "enum": ["partial_runtime_health_integrated"]
    },
    "date": {"type": "string"},
    "host": {
      "type": "object",
      "required": ["ip", "asset_key", "hostname", "role", "timezone", "observe_only"],
      "properties": {
        "ip": {"type": "string"},
        "asset_key": {"type": "string"},
        "hostname": {"type": "string"},
        "role": {"type": "string"},
        "timezone": {"type": "string"},
        "observe_only": {"type": "boolean"}
      },
      "additionalProperties": false
    },
    "mode": {
      "type": "string",
      "enum": ["observe_only"]
    },
    "live_checks": {
      "type": "object",
      "required": [
        "ssh_access",
        "scanner_api_health",
        "scanner_service",
        "node_exporter",
        "scheduled_jobs",
        "docker_services",
        "post_update_health"
      ],
      "properties": {
        "ssh_access": {"type": "string"},
        "scanner_api_health": {"type": "string"},
        "scanner_service": {"type": "string"},
        "node_exporter": {"type": "string"},
        "scheduled_jobs": {
          "type": "array",
          "items": {"type": "string"}
        },
        "docker_services": {
          "type": "array",
          "items": {"type": "string"}
        },
        "post_update_health": {"type": "string"}
      },
      "additionalProperties": false
    },
    "updates_applied": {
      "type": "object",
      "required": [
        "apt_update",
        "targeted_packages_upgraded",
        "new_packages_installed",
        "timezone_changed_to",
        "reboot_required",
        "remaining_upgradable_count",
        "full_upgrade_status"
      ],
      "properties": {
        "apt_update": {"type": "string"},
        "targeted_packages_upgraded": {
          "type": "array",
          "items": {"type": "string"}
        },
        "new_packages_installed": {
          "type": "array",
          "items": {"type": "string"}
        },
        "timezone_changed_to": {"type": "string"},
        "reboot_required": {"type": "boolean"},
        "remaining_upgradable_count": {"type": "integer", "minimum": 0},
        "full_upgrade_status": {"type": "string"}
      },
      "additionalProperties": false
    },
    "integration_state": {
      "type": "object",
      "required": [
        "already_integrated",
        "not_yet_integrated",
        "awooop_consumption"
      ],
      "properties": {
        "already_integrated": {
          "type": "array",
          "items": {"type": "string"}
        },
        "not_yet_integrated": {
          "type": "array",
          "items": {"type": "string"}
        },
        "awooop_consumption": {"type": "string"}
      },
      "additionalProperties": false
    },
    "risk_register": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["risk", "severity", "status", "next_action"],
        "properties": {
          "risk": {"type": "string"},
          "severity": {
            "type": "string",
            "enum": ["LOW", "MEDIUM", "HIGH"]
          },
          "status": {"type": "string"},
          "next_action": {"type": "string"}
        },
        "additionalProperties": false
      }
    },
    "next_gates": {
      "type": "array",
      "items": {"type": "string"}
    },
    "still_forbidden": {
      "type": "array",
      "items": {"type": "string"}
    }
  },
  "additionalProperties": false
}
