{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "http://imgarena.com/schemas/tennis.rally.tracking.players/1.1.0",
  "title": "IMGA tennis.rally.tracking.players Schema",
  "description": "Describes all the player movement which happened during a rally",
  "type": "object",
  "required": [
    "created",
    "id",
    "type",
    "packetDetails",
    "matchDetails",
    "players"
  ],
  "additionalProperties": false,
  "properties": {
    "created": {
      "title": "Packet Creation Datetime",
      "type": "string",
      "format": "date-time"
    },
    "id": {
      "title": "Packet ID",
      "type": "string",
      "format": "uuid"
    },
    "type": {
      "title": "Packet Type",
      "const": "rally.tracking.players"
    },
    "packetDetails": {
      "title": "Packet Details",
      "$ref": "#/$defs/packetDetail"
    },
    "matchDetails": {
      "title": "Match Details",
      "$ref": "#/$defs/matchDetail",
      "description": "The details of the match at the point this packet was sent"
    },
    "players": {
      "title": "Player Movement Details",
      "description": "Details about the movement of the players during the packet",
      "type": "array",
      "items": {
        "$ref": "#/$defs/player"
      }
    }
  },
  "$defs": {
    "packetDetail": {
      "title": "Packet Details Schema",
      "type": "object",
      "required": [
        "set",
        "game",
        "point",
        "serve",
        "rally",
        "sequence",
        "start",
        "end"
      ],
      "additionalProperties": false,
      "properties": {
        "set": {
          "description": "The Set this packet is in",
          "type": "integer",
          "minimum": 1
        },
        "game": {
          "description": "The Game this packet is in",
          "type": "integer",
          "minimum": 1
        },
        "point": {
          "description": "The Point this packet is in",
          "type": "integer",
          "minimum": 1
        },
        "serve": {
          "description": "The Serve this packet is in",
          "type": "integer",
          "minimum": 1
        },
        "rally": {
          "description": "The Rally this packet is in",
          "type": "integer",
          "minimum": 1
        },
        "sequence": {
          "description": "The Sequence of this packet",
          "type": "integer",
          "minimum": 1
        },
        "slice": {
          "description": "The Slice of the Sequence of this packet",
          "type": "integer",
          "minimum": 1
        },
        "shot": {
          "description": "The total number of shots so far up to and including this packet",
          "type": "integer",
          "minimum": 1
        },
        "arc": {
          "description": "The total number of arcs so far up to and including this packet",
          "type": "integer",
          "minimum": 1
        },
        "start": {
          "description": "The UTC start timestamp of this packet",
          "type": "string",
          "format": "date-time"
        },
        "end": {
          "description": "The UTC end timestamp of this packet",
          "type": "string",
          "format": "date-time"
        },
        "update": {
          "description": "Is this packet an update to a previous packet",
          "type": "boolean"
        },
        "updatedPacketId": {
          "description": "The packet ID being updated",
          "type": "string",
          "format": "uuid"
        }
      },
      "examples": [
        {
          "set": 1,
          "game": 1,
          "point": 1,
          "serve": 1,
          "rally": 1,
          "sequence": 1,
          "start": "2022-08-14T06:10:13.7513333Z",
          "end": "2022-08-14T06:10:20.4825333Z"
        }
      ]
    },
    "matchDetail": {
      "title": "Match Details Schema",
      "type": "object",
      "required": [
        "competitionId",
        "year",
        "court",
        "matchId",
        "singles",
        "wheelchair",
        "electronicLineCalling",
        "televised",
        "format",
        "round",
        "players"
      ],
      "additionalProperties": false,
      "properties": {
        "year": {
          "description": "The year of the match",
          "type": "integer",
          "minimum": 2020,
          "maximum": 2100
        },
        "competitionId": {
          "description": "The competition id for the match",
          "type": "string"
        },
        "matchId": {
          "description": "The match id",
          "type": "string"
        },
        "court": {
          "description": "The court the match is being played in",
          "type": "string"
        },
        "singles": {
          "description": "Is the match a singles match",
          "type": "boolean"
        },
        "wheelchair": {
          "description": "Is the match wheelchair based",
          "type": "boolean"
        },
        "electronicLineCalling": {
          "description": "Is electronic line calling being used",
          "type": "boolean"
        },
        "televised": {
          "description": "Is the match televised",
          "type": "boolean"
        },
        "format": {
          "description": "The match format",
          "type": "string"
        },
        "round": {
          "description": "The match round string",
          "type": "string"
        },
        "players": {
          "description": "The players involved in the match",
          "type": "array",
          "items": {
            "$ref": "#/$defs/playerDetail"
          }
        }
      },
      "examples": [
        {
          "competitionId": "5817",
          "year": 2022,
          "court": "2",
          "matchId": "LS001",
          "singles": true,
          "wheelchair": false,
          "electronicLineCalling": false,
          "televised": false,
          "format": "BestOfThreeTiebreakSets",
          "round": "RoundOf2",
          "players": [
            {
              "team": 1,
              "player": 1,
              "id": "320922",
              "seed": "",
              "firstName": "Ksenia",
              "lastName": "Laskutova"
            },
            {
              "team": 2,
              "player": 1,
              "id": "00BQ9O",
              "seed": "",
              "firstName": "Marketa",
              "lastName": "Petruzelova"
            }
          ]
        }
      ]
    },
    "playerDetail": {
      "title": "Player Detail schema",
      "type": "object",
      "required": [
        "team",
        "player",
        "id",
        "firstName",
        "lastName"
      ],
      "additionalProperties": false,
      "properties": {
        "team": {
          "title": "The team the player is in",
          "description": "This is a numeric depiction of how many teams there are and which team the player resides in",
          "type": "integer",
          "minimum": 1
        },
        "player": {
          "title": "The id of the player in the team",
          "description": "This is a numeric depiction of how many players there are in a team.",
          "type": "integer",
          "minimum": 1
        },
        "id": {
          "title": "Competition Player ID",
          "type": "string"
        },
        "seed": {
          "title": "Player Seed",
          "type": "string"
        },
        "firstName": {
          "title": "Player's first name",
          "type": "string"
        },
        "lastName": {
          "title": "Player's last name",
          "type": "string"
        }
      },
      "examples": [
        {
          "team": 1,
          "player": 1,
          "id": "320922",
          "seed": "",
          "firstName": "Ksenia",
          "lastName": "Laskutova"
        },
        {
          "team": 2,
          "player": 1,
          "id": "00BQ9O",
          "seed": "",
          "firstName": "Marketa",
          "lastName": "Petruzelova"
        }
      ]
    },
    "player": {
      "title": "Player Schema",
      "type": "object",
      "required": [
        "team",
        "player",
        "tracks"
      ],
      "additionalProperties": false,
      "properties": {
        "team": {
          "description": "The team id the player belongs to",
          "type": "integer",
          "minimum": 1
        },
        "player": {
          "description": "The player id in the team",
          "type": "integer",
          "minimum": 1
        },
        "tracks": {
          "description": "The player's tracks",
          "type": "array",
          "items": {
            "$ref": "#/$defs/track"
          }
        }
      },
      "examples": [
        {
          "team": 1,
          "player": 1,
          "tracks": [
            {
              "time": 0.0,
              "position": [
                14.923,
                -3.938
              ],
              "velocity": [
                0.793,
                -0.931
              ]
            },
            {
              "time": 0.02,
              "position": [
                14.935,
                -3.953
              ],
              "velocity": [
                0.757,
                -1.126
              ]
            },
            {
              "time": 0.04,
              "position": [
                14.965,
                -4.008
              ],
              "velocity": [
                1.397,
                -1.017
              ]
            },
            {
              "time": 0.06,
              "position": [
                14.986,
                -4.008
              ],
              "velocity": [
                0.73,
                -0.409
              ]
            },
            {
              "time": 0.08,
              "position": [
                15.0,
                -4.006
              ],
              "velocity": [
                0.711,
                0.212
              ]
            },
            {
              "time": 0.1,
              "position": [
                15.01,
                -4.006
              ],
              "velocity": [
                -0.028,
                -0.232
              ]
            },
            {
              "time": 0.12,
              "position": [
                15.016,
                -4.007
              ],
              "velocity": [
                0.617,
                -0.359
              ]
            },
            {
              "time": 0.14,
              "position": [
                15.029,
                -4.025
              ],
              "velocity": [
                0.821,
                -0.227
              ]
            },
            {
              "time": 0.16,
              "position": [
                15.038,
                -4.024
              ],
              "velocity": [
                0.226,
                0.073
              ]
            },
            {
              "time": 0.18,
              "position": [
                15.049,
                -4.023
              ],
              "velocity": [
                -0.073,
                -0.995
              ]
            },
            {
              "time": 0.2,
              "position": [
                15.055,
                -4.037
              ],
              "velocity": [
                1.065,
                0.068
              ]
            },
            {
              "time": 0.22,
              "position": [
                15.069,
                -4.054
              ],
              "velocity": [
                0.928,
                -1.455
              ]
            },
            {
              "time": 0.24,
              "position": [
                15.082,
                -4.083
              ],
              "velocity": [
                -0.469,
                -0.913
              ]
            }
          ]
        }
      ]
    },
    "track": {
      "title": "Track Schema",
      "type": "object",
      "required": [
        "time",
        "position",
        "velocity"
      ],
      "additionalProperties": false,
      "properties": {
        "time": {
          "description": "Time relative to start of packet",
          "type": "number",
          "minimum": 0
        },
        "position": {
          "title": "Position of Track",
          "description": "The X, Y, & Z components of the position of the person",
          "type": "array",
          "minItems": 2,
          "maxItems": 3,
          "items": {
            "type": "number"
          },
          "examples": [
            [
              14.923,
              -3.938
            ],
            [
              14.935,
              -3.953
            ]
          ]
        },
        "velocity": {
          "title": "Velocity of Track",
          "description": "The X, Y, & Z components of the position of the person",
          "type": "array",
          "minItems": 2,
          "maxItems": 3,
          "items": {
            "type": "number"
          },
          "examples": [
            [
              0.793,
              -0.931
            ],
            [
              0.757,
              -1.126
            ]
          ]
        }
      },
      "examples": [
        {
          "time": 0.0,
          "position": [
            14.923,
            -3.938
          ],
          "velocity": [
            0.793,
            -0.931
          ]
        },
        {
          "time": 0.02,
          "position": [
            14.935,
            -3.953
          ],
          "velocity": [
            0.757,
            -1.126
          ]
        }
      ]
    }
  },
  "examples": [
    {
      "created": "2022-08-14T06:10:23.4908526Z",
      "id": "e28fc19b-69ec-4504-b77b-a4e0cca6ef46",
      "type": "live.tracking.people",
      "packetDetails": {
        "set": 1,
        "game": 1,
        "point": 1,
        "serve": 1,
        "rally": 1,
        "sequence": 1,
        "start": "2022-08-14T06:10:13.7513333Z",
        "end": "2022-08-14T06:10:20.4825333Z"
      },
      "matchDetails": {
        "competitionId": "5817",
        "year": 2022,
        "court": "2",
        "matchId": "LS001",
        "singles": true,
        "wheelchair": false,
        "electronicLineCalling": false,
        "televised": false,
        "format": "BestOfThreeTiebreakSets",
        "round": "RoundOf2",
        "players": [
          {
            "team": 1,
            "player": 1,
            "id": "320922",
            "seed": "",
            "firstName": "Ksenia",
            "lastName": "Laskutova"
          },
          {
            "team": 2,
            "player": 1,
            "id": "00BQ9O",
            "seed": "",
            "firstName": "Marketa",
            "lastName": "Petruzelova"
          }
        ]
      },
      "people": [
        {
          "team": 1,
          "player": 1,
          "tracks": [
            {
              "time": 0.0,
              "position": [
                14.923,
                -3.938
              ],
              "velocity": [
                0.793,
                -0.931
              ]
            },
            {
              "time": 0.02,
              "position": [
                14.935,
                -3.953
              ],
              "velocity": [
                0.757,
                -1.126
              ]
            },
            {
              "time": 0.04,
              "position": [
                14.965,
                -4.008
              ],
              "velocity": [
                1.397,
                -1.017
              ]
            },
            {
              "time": 0.06,
              "position": [
                14.986,
                -4.008
              ],
              "velocity": [
                0.73,
                -0.409
              ]
            },
            {
              "time": 0.08,
              "position": [
                15.0,
                -4.006
              ],
              "velocity": [
                0.711,
                0.212
              ]
            },
            {
              "time": 0.1,
              "position": [
                15.01,
                -4.006
              ],
              "velocity": [
                -0.028,
                -0.232
              ]
            },
            {
              "time": 0.12,
              "position": [
                15.016,
                -4.007
              ],
              "velocity": [
                0.617,
                -0.359
              ]
            },
            {
              "time": 0.14,
              "position": [
                15.029,
                -4.025
              ],
              "velocity": [
                0.821,
                -0.227
              ]
            },
            {
              "time": 0.16,
              "position": [
                15.038,
                -4.024
              ],
              "velocity": [
                0.226,
                0.073
              ]
            },
            {
              "time": 0.18,
              "position": [
                15.049,
                -4.023
              ],
              "velocity": [
                -0.073,
                -0.995
              ]
            },
            {
              "time": 0.2,
              "position": [
                15.055,
                -4.037
              ],
              "velocity": [
                1.065,
                0.068
              ]
            },
            {
              "time": 0.22,
              "position": [
                15.069,
                -4.054
              ],
              "velocity": [
                0.928,
                -1.455
              ]
            },
            {
              "time": 0.24,
              "position": [
                15.082,
                -4.083
              ],
              "velocity": [
                -0.469,
                -0.913
              ]
            }
          ]
        }
      ]
    }
  ]
}
