{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:local-git-remote-inventory-v1",
  "title": "AWOOOI 本機 Git Remote 盤點事件 (v1)",
  "description": "本機可見 Git working tree 的 read-only remote 盤點事件。此事件只作為 Gitea server 全量盤點受阻時的輔助 evidence，不授權同步、刪除或主控切換。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "roots",
    "max_depth",
    "gitea_host_fragment",
    "repo_count",
    "gitea_linked_count",
    "github_linked_count",
    "mapped_count",
    "gitea_only_count",
    "github_only_count",
    "internal_110_only_count",
    "unique_gitea_repo_count",
    "unique_github_repo_count",
    "unique_internal_110_repo_count",
    "unique_gitea_repos",
    "unique_github_repos",
    "unique_internal_110_repos",
    "repos"
  ],
  "properties": {
    "schema_version": {
      "const": "local_git_remote_inventory_v1"
    },
    "status": {
      "type": "string",
      "enum": ["partial", "empty"]
    },
    "roots": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "max_depth": {
      "type": "integer",
      "minimum": 0
    },
    "gitea_host_fragment": {
      "type": "string",
      "minLength": 1
    },
    "repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "gitea_linked_count": {
      "type": "integer",
      "minimum": 0
    },
    "github_linked_count": {
      "type": "integer",
      "minimum": 0
    },
    "mapped_count": {
      "type": "integer",
      "minimum": 0
    },
    "gitea_only_count": {
      "type": "integer",
      "minimum": 0
    },
    "github_only_count": {
      "type": "integer",
      "minimum": 0
    },
    "internal_110_only_count": {
      "type": "integer",
      "minimum": 0
    },
    "unique_gitea_repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "unique_github_repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "unique_internal_110_repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "unique_gitea_repos": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "unique_github_repos": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "unique_internal_110_repos": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "repos": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "repo_path",
          "repo_name",
          "status",
          "gitea_repos",
          "github_repos",
          "internal_110_repos",
          "remotes"
        ],
        "properties": {
          "repo_path": {
            "type": "string"
          },
          "repo_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "mapped",
              "gitea_only_local",
              "github_only_local",
              "internal_110_only",
              "other_remote"
            ]
          },
          "gitea_repos": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "github_repos": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "internal_110_repos": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "remotes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "kind",
                "url_redacted",
                "repo_slug"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": ["gitea", "github", "internal_git_110", "gitlab_110", "other"]
                },
                "url_redacted": {
                  "type": "string"
                },
                "repo_slug": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
