{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:gitea-repo-inventory-v1",
  "title": "AWOOOI Gitea Repo 全量盤點事件 (v1)",
  "description": "Gitea 全量 repo 清單的 read-only 盤點事件。此事件只作為 GitHub primary 遷移前 evidence，不授權同步、刪除或主控切換。",
  "type": "object",
  "required": [
    "schema_version",
    "base_url",
    "org",
    "github_owner",
    "query_mode",
    "query",
    "visibility_scope",
    "token_present",
    "http_status",
    "status",
    "blocking_reason",
    "repo_count",
    "repos"
  ],
  "properties": {
    "schema_version": {
      "const": "gitea_repo_inventory_v1"
    },
    "base_url": {
      "type": "string",
      "minLength": 1
    },
    "org": {
      "type": "string",
      "minLength": 1
    },
    "github_owner": {
      "type": "string"
    },
    "query_mode": {
      "type": "string",
      "enum": ["org", "user", "search", "export"]
    },
    "query": {
      "type": "string"
    },
    "visibility_scope": {
      "type": "string",
      "enum": ["public_only", "authenticated", "admin_export", "unknown"],
      "description": "public_only 代表未提供 token 時的公開可見範圍，不等同 server 全量。"
    },
    "token_present": {
      "type": "boolean",
      "description": "只表示執行時是否有提供 token，不儲存 token value。"
    },
    "http_status": {
      "type": ["integer", "null"],
      "minimum": 100,
      "maximum": 599
    },
    "status": {
      "type": "string",
      "enum": ["ok", "partial", "blocked"]
    },
    "blocking_reason": {
      "type": "string"
    },
    "repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "repos": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "gitea_repo",
          "name",
          "owner",
          "private",
          "empty",
          "archived",
          "default_branch",
          "clone_url_redacted",
          "ssh_url_redacted",
          "github_repo_candidate"
        ],
        "properties": {
          "gitea_repo": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "empty": {
            "type": "boolean"
          },
          "archived": {
            "type": "boolean"
          },
          "default_branch": {
            "type": "string"
          },
          "clone_url_redacted": {
            "type": "string"
          },
          "ssh_url_redacted": {
            "type": "string"
          },
          "github_repo_candidate": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
