{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/livetennisapi-com/json-schema/livetennisapi-com-player-stoppages-meta-schema.json",
  "title": "PlayerStoppagesMeta",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/livetennisapi-com-players-api-openapi.yml#/components/schemas/PlayerStoppagesMeta",
  "type": "object",
  "properties": {
    "player_id": {
      "type": "integer"
    },
    "window": {
      "type": "object",
      "description": "The bounds actually applied, UTC.",
      "properties": {
        "since": {
          "type": "string",
          "format": "date-time"
        },
        "until": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "kinds": {
      "type": "array",
      "description": "The kinds this response was filtered to.",
      "items": {
        "type": "string"
      }
    },
    "counts": {
      "type": "object",
      "description": "Per selected kind, the number of rows over the WHOLE window (not the page).",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "latest_medical_timeout": {
      "oneOf": [
        {
          "$ref": "#/$defs/PlayerStoppage"
        },
        {
          "type": "null"
        }
      ],
      "description": "The newest medical timeout in the window, whatever the page or kind filter; null when none."
    },
    "previous_medical_timeout": {
      "oneOf": [
        {
          "$ref": "#/$defs/PlayerStoppage"
        },
        {
          "type": "null"
        }
      ],
      "description": "The one before it; null when fewer than two."
    },
    "record_starts": {
      "type": "object",
      "description": "How far back each family is recorded — read before trusting a long window.",
      "properties": {
        "stoppages": {
          "type": "string",
          "description": "2026-09-12 — no stoppage row exists before this day."
        },
        "outcomes": {
          "type": [
            "string",
            "null"
          ],
          "description": "Date of the oldest match with a stated winner (the field an outcome row needs)."
        }
      }
    },
    "note": {
      "type": "string",
      "description": "In-match stoppages and match outcomes only; no off-court injury record."
    },
    "limit": {
      "type": "integer"
    },
    "count": {
      "type": "integer"
    },
    "has_more": {
      "type": "boolean"
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass back as `?before=`; null when the window is exhausted."
    }
  },
  "$defs": {
    "PlayerStoppage": {
      "description": "One row of GET /players/{playerId}/stoppages — an in-match stoppage on one of the player's matches, or a match the player did not finish. Stoppage rows carry `score_at`, `duration_seconds` and `reason`; outcome rows carry `final_score` when a score row exists. Never inferred except `pause` (source_stated false).",
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "medical_timeout",
            "trainer_called",
            "toilet_break",
            "pause",
            "stoppage",
            "retirement",
            "walkover"
          ]
        },
        "at": {
          "type": "string",
          "format": "date-time",
          "description": "UTC instant of the stoppage (the source's own instant) or of the recorded outcome."
        },
        "match_id": {
          "type": "integer"
        },
        "tournament": {
          "type": [
            "string",
            "null"
          ]
        },
        "opponent": {
          "type": [
            "object",
            "null"
          ],
          "description": "The other side of the match; null when unknown.",
          "properties": {
            "id": {
              "type": "integer"
            },
            "name": {
              "type": "string"
            }
          }
        },
        "score_at": {
          "type": "object",
          "description": "Stoppage rows only — the score at the stoppage.",
          "properties": {
            "sets": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "integer"
              }
            },
            "games": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            },
            "points": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "final_score": {
          "type": "object",
          "description": "Outcome rows only, when a score row exists — sets and games of the newest score row.",
          "properties": {
            "sets": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "games": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          }
        },
        "attribution": {
          "type": "string",
          "enum": [
            "player",
            "match"
          ],
          "description": "`player` — the source named this player's side (or the result names them as the non-winner); `match` — the source stated the stoppage for the match without a side, so the row appears in both players' lists."
        },
        "duration_seconds": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Seconds to the matching end row; null when no end row was recorded and on outcome rows."
        },
        "source_stated": {
          "type": "boolean",
          "description": "True when a scorer, umpire, live-scoring state or result stated it; false only on `pause` (clock-inferred)."
        },
        "reason": {
          "type": "string",
          "description": "Stoppage rows only — the stated reason; `unknown` when only a flag reached us."
        }
      }
    }
  }
}