{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/statshawk-ai/json-schema/statshawk-ai-public-stat-response-fixture-audit-schema.json",
  "title": "PublicStatResponseFixtureAudit",
  "description": "Successful response envelope: resource data and source-free request metadata.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/statshawk-ai-openapi.json#/components/schemas/PublicStatResponseFixtureAudit",
  "type": "object",
  "required": [
    "data",
    "meta"
  ],
  "properties": {
    "data": {
      "$ref": "#/$defs/FixtureAudit",
      "description": "Resource payload returned by this endpoint, inside the success envelope."
    },
    "meta": {
      "$ref": "#/$defs/PublicMeta",
      "description": "Request identifier, fetch timestamp, response cache state and version; never a source."
    }
  },
  "$defs": {
    "CacheStatus": {
      "type": "string",
      "description": "Response cache status, serialized as an uppercase token.\n`HIT` means a relevant store read or handler response cache returned a cached payload; `MISS` means a cache miss or an uncached read.\n`STALE` means a cached payload passed its fresh TTL but remains inside the allowed stale interval. It does not guarantee a refresh has started. Current entity-store caching records HIT or MISS.\nComposite reads report the last store-call outcome; this does not prove every nested resource shares one fetch time.",
      "enum": [
        "HIT",
        "MISS",
        "STALE"
      ]
    },
    "ContestId": {
      "type": "string",
      "description": "Canonical contest identifier (`cst_…`) for a team match, individual match, or field event; used by public contest routes.\nCanonical entity identifier (`cst_<base32>`). The suffix is exactly 26 Crockford base32 symbols encoding a UUID. Output uses lowercase without padding. The prefix is case-sensitive; another entity type’s prefix and bare UUID/source identifiers are rejected. Treat the full identifier as opaque."
    },
    "EarlierHistory": {
      "type": "string",
      "enum": [
        "unknown"
      ]
    },
    "EntrantId": {
      "type": "string",
      "description": "Canonical entrant identifier (`ent_…`): the competitor backed by a team, person, pair, or animal, not the contest-entry edge.\nCanonical entity identifier (`ent_<base32>`). The suffix is exactly 26 Crockford base32 symbols encoding a UUID. Output uses lowercase without padding. The prefix is case-sensitive; another entity type’s prefix and bare UUID/source identifiers are rejected. Treat the full identifier as opaque."
    },
    "FixtureAudit": {
      "type": "object",
      "required": [
        "contest_id",
        "snapshot_no",
        "earlier_history",
        "events"
      ],
      "properties": {
        "audit_start": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "contest_id": {
          "$ref": "#/$defs/ContestId"
        },
        "current": {
          "oneOf": [
            {
              "type": "null",
              "description": "Accepts the JSON null value."
            },
            {
              "$ref": "#/$defs/PublicFixtureState"
            }
          ]
        },
        "earlier_history": {
          "$ref": "#/$defs/EarlierHistory"
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PublicFixtureEvent"
          }
        },
        "next_cursor": {
          "type": [
            "string",
            "null"
          ]
        },
        "notice": {
          "oneOf": [
            {
              "type": "null",
              "description": "Accepts the JSON null value."
            },
            {
              "$ref": "#/$defs/PublicFixtureNotice"
            }
          ]
        },
        "snapshot_no": {
          "$ref": "#/$defs/PublicSnapshotNo"
        }
      }
    },
    "PersonId": {
      "type": "string",
      "description": "Canonical sport-agnostic person id (`per_...`).\nCanonical entity identifier (`per_<base32>`). The suffix is exactly 26 Crockford base32 symbols encoding a UUID. Output uses lowercase without padding. The prefix is case-sensitive; another entity type’s prefix and bare UUID/source identifiers are rejected. Treat the full identifier as opaque."
    },
    "PublicFixtureEntrant": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "entrant_id",
            "person_id",
            "name",
            "kind"
          ],
          "properties": {
            "entrant_id": {
              "$ref": "#/$defs/EntrantId"
            },
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"individual\" selects this member.",
              "enum": [
                "individual"
              ]
            },
            "name": {
              "type": "string"
            },
            "person_id": {
              "$ref": "#/$defs/PersonId"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "entrant_id",
            "members",
            "kind"
          ],
          "properties": {
            "entrant_id": {
              "$ref": "#/$defs/EntrantId"
            },
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"pair\" selects this member.",
              "enum": [
                "pair"
              ]
            },
            "members": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/PublicFixturePerson"
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"redacted\" selects this member.",
              "enum": [
                "redacted"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"unresolved_opponent\" selects this member.",
              "enum": [
                "unresolved_opponent"
              ]
            }
          }
        }
      ]
    },
    "PublicFixtureEvent": {
      "type": "object",
      "required": [
        "event_id",
        "recorded_at",
        "kind",
        "reason"
      ],
      "properties": {
        "accepted_revision": {
          "oneOf": [
            {
              "type": "null",
              "description": "Accepts the JSON null value."
            },
            {
              "$ref": "#/$defs/PublicFixtureRevisionId"
            }
          ]
        },
        "after": {
          "oneOf": [
            {
              "type": "null",
              "description": "Accepts the JSON null value."
            },
            {
              "$ref": "#/$defs/PublicFixtureState"
            }
          ]
        },
        "before": {
          "oneOf": [
            {
              "type": "null",
              "description": "Accepts the JSON null value."
            },
            {
              "$ref": "#/$defs/PublicFixtureState"
            }
          ]
        },
        "event_id": {
          "$ref": "#/$defs/PublicFixtureEventId"
        },
        "kind": {
          "$ref": "#/$defs/PublicFixtureEventKind"
        },
        "reason": {
          "$ref": "#/$defs/PublicFixtureReason"
        },
        "recorded_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "PublicFixtureEventId": {
      "type": "string",
      "format": "uuid"
    },
    "PublicFixtureEventKind": {
      "type": "string",
      "enum": [
        "entrants_confirmed",
        "opponent_updated",
        "update_blocked",
        "baseline_recorded",
        "notice_resolved",
        "fixture_corrected"
      ]
    },
    "PublicFixtureNotice": {
      "type": "object",
      "required": [
        "reason"
      ],
      "properties": {
        "reason": {
          "$ref": "#/$defs/PublicFixtureReason"
        }
      }
    },
    "PublicFixturePerson": {
      "type": "object",
      "required": [
        "person_id",
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "person_id": {
          "$ref": "#/$defs/PersonId"
        }
      }
    },
    "PublicFixtureReason": {
      "type": "string",
      "enum": [
        "confirmed",
        "pre_play_replacement",
        "membership_conflict",
        "unresolved_opponent",
        "invalid_sides",
        "protected_facts",
        "administrative_correction",
        "conflict_resolved"
      ]
    },
    "PublicFixtureRevisionId": {
      "type": "string",
      "format": "uuid"
    },
    "PublicFixtureState": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "revision",
            "sides",
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"checked_pair\" selects this member.",
              "enum": [
                "checked_pair"
              ]
            },
            "revision": {
              "$ref": "#/$defs/PublicFixtureRevisionId"
            },
            "sides": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/PublicFixtureEntrant"
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "entrants",
            "kind"
          ],
          "properties": {
            "entrants": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/PublicFixtureEntrant"
              }
            },
            "kind": {
              "type": "string",
              "description": "Union discriminator `kind`: the literal \"unverified_membership\" selects this member.",
              "enum": [
                "unverified_membership"
              ]
            }
          }
        }
      ]
    },
    "PublicMeta": {
      "type": "object",
      "description": "Response metadata: exactly four fields, and no source.",
      "required": [
        "request_id",
        "fetched_at",
        "cache",
        "version"
      ],
      "properties": {
        "cache": {
          "$ref": "#/$defs/CacheStatus"
        },
        "fetched_at": {
          "type": "string",
          "format": "date-time"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "PublicSnapshotNo": {
      "type": "string",
      "description": "A committed snapshot number, as a decimal string."
    }
  }
}