{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:seogeohq:skill-rule-batch:0.1.0",
  "title": "本地skill规则候选批次",
  "type": "object",
  "required": [
    "schema_version",
    "batch_id",
    "source_commit",
    "publication_status",
    "rules"
  ],
  "properties": {
    "schema_version": {
      "const": "0.1.0"
    },
    "batch_id": {
      "type": "string"
    },
    "source_commit": {
      "type": "string",
      "pattern": "^[a-f0-9]{40}$"
    },
    "publication_status": {
      "const": "published_for_review"
    },
    "rules": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/rule"
      }
    }
  },
  "$defs": {
    "rule": {
      "type": "object",
      "required": [
        "id",
        "canonical_key",
        "text",
        "when",
        "dont",
        "check",
        "evaluation",
        "primary_review",
        "lineage",
        "revision",
        "publication_status",
        "last_verified",
        "automatic_scoring",
        "site_tested"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^tech-[a-z0-9-]+$"
        },
        "canonical_key": {
          "type": "string"
        },
        "text": {
          "type": "string",
          "minLength": 1
        },
        "when": {
          "type": "string",
          "minLength": 1
        },
        "dont": {
          "type": "string",
          "minLength": 1
        },
        "check": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "evaluation": {
          "type": "object",
          "required": [
            "pass",
            "fail",
            "not_applicable",
            "insufficient_evidence"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "revision": {
          "type": "string",
          "pattern": "^[a-f0-9]{16}$"
        },
        "last_verified": {
          "type": "null"
        },
        "site_tested": {
          "const": false
        },
        "automatic_scoring": {
          "const": false
        },
        "publication_status": {
          "const": "published_for_review"
        },
        "primary_review": {
          "type": "object",
          "required": [
            "status",
            "sources",
            "qualification"
          ],
          "properties": {
            "status": {
              "enum": [
                "primary_supported",
                "qualified_primary",
                "skill_extracted",
                "heuristic",
                "pending_primary"
              ]
            }
          }
        },
        "lineage": {
          "type": "array",
          "minItems": 1
        }
      }
    }
  }
}