{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/livetennisapi-com/json-schema/livetennisapi-com-rally-point-schema.json",
  "title": "RallyPoint",
  "description": "One charted point. `raw` is the charter's own string, verbatim, and is ALWAYS present; the parsed fields are our reading of it. `parsed` is false when the notation contained something we could not read cleanly — the recognised part is still returned. A consumer who wants only unambiguous rows filters on `parsed`.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/livetennisapi-com-history-api-openapi.yml#/components/schemas/RallyPoint",
  "type": "object",
  "properties": {
    "point": {
      "type": "integer"
    },
    "set": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "null"
        ]
      },
      "maxItems": 2
    },
    "games": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "null"
        ]
      },
      "maxItems": 2
    },
    "score": {
      "type": [
        "string",
        "null"
      ],
      "description": "e.g. '30-40'."
    },
    "game": {
      "type": [
        "integer",
        "null"
      ]
    },
    "is_tiebreak": {
      "type": "boolean"
    },
    "server": {
      "type": [
        "integer",
        "null"
      ],
      "enum": [
        1,
        2,
        null
      ]
    },
    "point_winner": {
      "type": [
        "integer",
        "null"
      ],
      "enum": [
        1,
        2,
        null
      ]
    },
    "raw": {
      "type": [
        "string",
        "null"
      ],
      "description": "The charter's shot string; both serves joined by ';' when the first was a fault."
    },
    "parsed": {
      "type": "boolean"
    },
    "serve_number": {
      "type": [
        "integer",
        "null"
      ],
      "enum": [
        1,
        2,
        null
      ]
    },
    "serve_direction": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "wide",
        "body",
        "down_the_t",
        null
      ]
    },
    "rally_length": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Strokes including the serve. An ace is 1, a double fault 0."
    },
    "outcome": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "winner",
        "forced_error",
        "unforced_error",
        "error",
        "other",
        null
      ],
      "description": "`error` = the charter recorded a miss without saying whether it was forced. Never guessed."
    },
    "error_location": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "net",
        "wide",
        "deep",
        "wide_and_deep",
        null
      ]
    },
    "ending_stroke": {
      "type": [
        "string",
        "null"
      ]
    },
    "ending_wing": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_ace": {
      "type": "boolean"
    },
    "is_double_fault": {
      "type": "boolean"
    },
    "is_serve_and_volley": {
      "type": "boolean"
    },
    "is_unreturned": {
      "type": "boolean",
      "description": "Derived (added 2026-09-05). The server won the point without the returner putting the ball in play. A double fault is never unreturned."
    },
    "unreturned_kind": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ace",
        "serve_winner",
        "serve_forced_error",
        "return_forced_error",
        "return_unforced_error",
        "return_error",
        null
      ],
      "description": "How the serve went unreturned. `serve_winner` is a serve winner charted without a direction code (so `is_ace` is unset) — count it with the aces. `return_error` = the return missed and the charter did not say whether it was forced. Null when the return was in play or the parse could not say."
    },
    "shots": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RallyShot"
      }
    }
  },
  "$defs": {
    "RallyShot": {
      "type": "object",
      "description": "One stroke. Shots are numbered from the serve: serve 1, return 2, the server's next ball 3.",
      "properties": {
        "number": {
          "type": "integer"
        },
        "code": {
          "type": "string",
          "description": "The charter's raw code, e.g. 'f'."
        },
        "stroke": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "serve",
            "groundstroke",
            "slice",
            "volley",
            "half_volley",
            "swinging_volley",
            "overhead",
            "drop_shot",
            "lob",
            "trick",
            "unknown",
            null
          ]
        },
        "wing": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "forehand",
            "backhand",
            null
          ],
          "description": "The side it was struck FROM."
        },
        "direction": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "forehand_side",
            "middle",
            "backhand_side",
            null
          ],
          "description": "Where the ball was sent."
        },
        "depth": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "shallow",
            "mid",
            "deep",
            null
          ]
        },
        "position": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "approaching",
            "at_net",
            "baseline",
            null
          ]
        }
      }
    }
  }
}