{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "github-observation.v1",
  "title": "OMS GitHub observation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "observation_key",
    "kind",
    "repository",
    "source_id_sha256",
    "source_version",
    "change",
    "presence_generation",
    "observed_at",
    "payload_sha256",
    "snapshot"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "observation_key": { "type": "string", "pattern": "^github-obs-[a-f0-9]{48}$" },
    "kind": { "type": "string", "enum": ["issue", "comment", "label", "branch", "pull_request", "review", "check"] },
    "repository": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,38}/[a-z0-9._-]{1,100}$" },
    "source_id_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "source_version": { "type": "string", "minLength": 1, "maxLength": 512 },
    "change": { "type": "string", "enum": ["present", "removed"] },
    "presence_generation": { "type": "integer", "minimum": 0 },
    "observed_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" },
    "payload_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "snapshot": { "type": "object" }
  }
}
