{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:security-mirror-dry-run-v1",
  "title": "資安供應鏈鏡像 Dry-run 報告契約 v1",
  "description": "定義 AwoooP mirror-only 資安資料接入演練時應回報的只讀結果格式。此契約不授權 runtime execution。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "date",
    "mode",
    "dry_run_status",
    "runtime_execution_authorized",
    "source_indexes",
    "summary",
    "dry_run_steps",
    "forbidden_actions"
  ],
  "properties": {
    "schema_version": {
      "const": "security_mirror_dry_run_v1"
    },
    "status": {
      "type": "string",
      "enum": ["draft"]
    },
    "date": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": ["mirror_only"]
    },
    "dry_run_status": {
      "type": "string",
      "enum": [
        "contract_defined_not_executed",
        "mirror_dry_run_pass",
        "mirror_dry_run_warn",
        "mirror_dry_run_blocked"
      ]
    },
    "runtime_execution_authorized": {
      "type": "boolean",
      "const": false
    },
    "source_indexes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "summary": {
      "type": "object",
      "required": [
        "total_contracts",
        "ready_for_mirror_count",
        "route_group_count",
        "acceptance_check_count",
        "quarantine_lane_count",
        "runtime_actions_executed",
        "payloads_ingested"
      ],
      "properties": {
        "total_contracts": {
          "type": "integer",
          "minimum": 0
        },
        "ready_for_mirror_count": {
          "type": "integer",
          "minimum": 0
        },
        "route_group_count": {
          "type": "integer",
          "minimum": 0
        },
        "acceptance_check_count": {
          "type": "integer",
          "minimum": 0
        },
        "quarantine_lane_count": {
          "type": "integer",
          "minimum": 0
        },
        "runtime_actions_executed": {
          "type": "boolean",
          "const": false
        },
        "payloads_ingested": {
          "type": "boolean",
          "const": false
        }
      },
      "additionalProperties": false
    },
    "dry_run_steps": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "step_id",
          "expected_observation",
          "evidence_refs",
          "pass_condition",
          "execution_allowed",
          "blocked_actions"
        ],
        "properties": {
          "step_id": {
            "type": "string"
          },
          "expected_observation": {
            "type": "string"
          },
          "evidence_refs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "pass_condition": {
            "type": "string"
          },
          "execution_allowed": {
            "type": "boolean",
            "const": false
          },
          "blocked_actions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          }
        },
        "additionalProperties": false
      }
    },
    "latest_local_validation": {
      "type": "object",
      "description": "本機 snapshot-only guard 的最近一次驗證結果；此欄位不代表 AwoooP production ingestion 已執行。",
      "required": [
        "status",
        "date",
        "scope",
        "command",
        "result",
        "validated_steps",
        "runtime_actions_executed",
        "payloads_ingested",
        "production_ingestion_enabled",
        "not_authorization"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "repo_snapshot_guard_pass",
            "repo_snapshot_guard_warn",
            "repo_snapshot_guard_blocked"
          ]
        },
        "date": {
          "type": "string"
        },
        "scope": {
          "type": "string",
          "enum": ["repo_snapshot_only"]
        },
        "command": {
          "type": "string"
        },
        "result": {
          "type": "string"
        },
        "validated_steps": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "runtime_actions_executed": {
          "type": "boolean",
          "const": false
        },
        "payloads_ingested": {
          "type": "boolean",
          "const": false
        },
        "production_ingestion_enabled": {
          "type": "boolean",
          "const": false
        },
        "not_authorization": {
          "type": "boolean",
          "const": true
        }
      },
      "additionalProperties": false
    },
    "forbidden_actions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    }
  },
  "additionalProperties": false
}
