{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:local-repo-canonical-probe-v1",
  "title": "AWOOOI 本機 Repo Canonical Lineage Probe 事件 (v1)",
  "description": "本機 Git working tree 的 read-only lineage 比對事件。此事件只作為 canonical repo 判定 evidence，不授權合併、同步、刪除或主控切換。",
  "type": "object",
  "required": [
    "schema_version",
    "group_name",
    "status",
    "sample_limit",
    "git_timeout_seconds",
    "repo_count",
    "comparison_count",
    "repos",
    "comparisons"
  ],
  "properties": {
    "schema_version": {
      "const": "local_repo_canonical_probe_v1"
    },
    "group_name": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "enum": ["related", "unrelated", "mixed", "partial"]
    },
    "sample_limit": {
      "type": "integer",
      "minimum": 1
    },
    "git_timeout_seconds": {
      "type": "integer",
      "minimum": 1
    },
    "repo_count": {
      "type": "integer",
      "minimum": 0
    },
    "comparison_count": {
      "type": "integer",
      "minimum": 0
    },
    "repos": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "label",
          "repo_path",
          "exists",
          "head_sha",
          "head_short",
          "branch",
          "commit_sample_count",
          "commits",
          "remotes",
          "probe_error"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "repo_path": {
            "type": "string"
          },
          "exists": {
            "type": "boolean"
          },
          "head_sha": {
            "type": "string"
          },
          "head_short": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "commit_sample_count": {
            "type": "integer",
            "minimum": 0
          },
          "commits": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{7,40}$"
            }
          },
          "remotes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["name", "url_redacted"],
              "properties": {
                "name": {
                  "type": "string"
                },
                "url_redacted": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          },
          "probe_error": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "comparisons": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "left_label",
          "right_label",
          "relation",
          "left_head",
          "right_head",
          "common_commit_count",
          "common_commit_samples"
        ],
        "properties": {
          "left_label": {
            "type": "string"
          },
          "right_label": {
            "type": "string"
          },
          "relation": {
            "type": "string",
            "enum": [
              "same_head",
              "left_descends_from_right",
              "right_descends_from_left",
              "shared_history",
              "no_shared_history",
              "partial_probe",
              "missing_repo"
            ]
          },
          "left_head": {
            "type": "string"
          },
          "right_head": {
            "type": "string"
          },
          "common_commit_count": {
            "type": "integer",
            "minimum": 0
          },
          "common_commit_samples": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{7,40}$"
            }
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
