{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.sportsnip.com/schemas/v1/game.json",
  "title": "SportSnip game (v1)",
  "description": "One match within an event.",
  "type": "object",
  "required": [
    "id",
    "event_id",
    "seq",
    "home",
    "away",
    "kickoff_stream_s",
    "end_stream_s",
    "final_score",
    "source"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "event_id": {
      "type": "string",
      "format": "uuid"
    },
    "seq": {
      "type": "integer",
      "minimum": 1,
      "description": "The game's number within the event"
    },
    "home": {
      "type": [
        "string",
        "null"
      ]
    },
    "away": {
      "type": [
        "string",
        "null"
      ]
    },
    "kickoff_stream_s": {
      "type": [
        "number",
        "null"
      ],
      "description": "Seconds from the start of the event's recording"
    },
    "end_stream_s": {
      "type": [
        "number",
        "null"
      ],
      "description": "Seconds from the start of the event's recording"
    },
    "final_score": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "home",
            "away"
          ],
          "properties": {
            "home": {
              "type": "integer",
              "minimum": 0
            },
            "away": {
              "type": "integer",
              "minimum": 0
            }
          },
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "source": {
      "enum": [
        "board",
        "sheet",
        "manual"
      ]
    }
  }
}
