{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:source-control-reconcile-plan-v1",
  "title": "AWOOOI Source Control Reconcile Plan (v1)",
  "description": "針對 Gitea -> GitHub refs-blocked repo 產生只讀、不可執行的 reconcile plan 草案。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "date",
    "default_mode",
    "inventory_gate",
    "plan_count",
    "plans"
  ],
  "properties": {
    "schema_version": {
      "const": "source_control_reconcile_plan_v1"
    },
    "status": {
      "type": "string",
      "enum": ["draft_blocked"]
    },
    "date": {
      "type": "string"
    },
    "default_mode": {
      "type": "string",
      "enum": ["plan_only"]
    },
    "inventory_gate": {
      "type": "object",
      "required": ["status", "reason", "required_before_execution"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["blocked", "ready"]
        },
        "reason": {
          "type": "string"
        },
        "required_before_execution": {
          "type": "array",
          "items": {"type": "string"}
        }
      },
      "additionalProperties": false
    },
    "plan_count": {
      "type": "integer",
      "minimum": 0
    },
    "plans": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "gitea_repo",
          "github_repo",
          "risk",
          "source_status",
          "divergence_summary",
          "proposed_plan_steps",
          "execution_gates",
          "allowed_now",
          "still_forbidden",
          "evidence_refs",
          "awooop_consumption"
        ],
        "properties": {
          "gitea_repo": {"type": "string"},
          "github_repo": {"type": "string"},
          "risk": {
            "type": "string",
            "enum": ["LOW", "MEDIUM", "HIGH"]
          },
          "source_status": {"type": "string"},
          "divergence_summary": {
            "type": "object",
            "required": [
              "gitea_branch_count",
              "github_branch_count",
              "gitea_tag_count",
              "github_tag_count",
              "gitea_main_sha",
              "github_main_sha",
              "blocking_reason"
            ],
            "properties": {
              "gitea_branch_count": {"type": "integer"},
              "github_branch_count": {"type": "integer"},
              "gitea_tag_count": {"type": "integer"},
              "github_tag_count": {"type": "integer"},
              "gitea_main_sha": {"type": "string"},
              "github_main_sha": {"type": "string"},
              "blocking_reason": {"type": "string"}
            },
            "additionalProperties": false
          },
          "proposed_plan_steps": {
            "type": "array",
            "items": {"type": "string"}
          },
          "execution_gates": {
            "type": "array",
            "items": {"type": "string"}
          },
          "allowed_now": {
            "type": "array",
            "items": {"type": "string"}
          },
          "still_forbidden": {
            "type": "array",
            "items": {"type": "string"}
          },
          "evidence_refs": {
            "type": "array",
            "items": {"type": "string"}
          },
          "awooop_consumption": {
            "type": "string",
            "enum": ["mirror_only", "approval_candidate"]
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
