{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:github-target-repo-approval-package-v1",
  "title": "AWOOOI GitHub Target Repo-by-repo Approval Package (v1)",
  "description": "把 GitHub target decision 中需要人工批准的 repo 拆成逐 repo approval package。此 package 不授權建立 repo、修改 visibility、同步 refs 或 GitHub primary 切換。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "source_snapshot",
    "package_count",
    "approval_items"
  ],
  "properties": {
    "schema_version": {
      "const": "github_target_repo_approval_package_v1"
    },
    "status": {
      "type": "string",
      "enum": ["draft"]
    },
    "source_snapshot": {
      "type": "string",
      "minLength": 1
    },
    "package_count": {
      "type": "integer",
      "minimum": 0
    },
    "approval_items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "github_repo",
          "source_key",
          "risk",
          "approval_action",
          "approval_status",
          "required_reviewers",
          "blocked_until",
          "allowed_after_approval",
          "still_forbidden",
          "evidence_refs",
          "notes"
        ],
        "properties": {
          "github_repo": {
            "type": "string"
          },
          "source_key": {
            "type": "string"
          },
          "risk": {
            "type": "string",
            "enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"]
          },
          "approval_action": {
            "type": "string",
            "enum": [
              "reconcile_refs_after_full_inventory",
              "create_or_grant_access_after_canonical_approval",
              "confirm_internal_remote_purpose"
            ]
          },
          "approval_status": {
            "type": "string",
            "enum": ["pending"]
          },
          "required_reviewers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "uniqueItems": true
          },
          "blocked_until": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_after_approval": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "still_forbidden": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "evidence_refs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notes": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
