{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "http://imgarena.com/schemas/tennis.rally.tracking.summary/1.1.0",
  "title": "IMGA tennis.rally.tracking.summary Schema",
  "description": "Describes all the summary for a rally",
  "type": "object",
  "required": [
    "created",
    "id",
    "type",
    "packetDetails",
    "matchDetails",
    "summary"
  ],
  "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.summary"
    },
    "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"
    },
    "summary": {
      "$ref": "#/$defs/summary"
    }
  },
  "$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"
        },
        "updatePacketId": {
          "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",
          "update": true,
          "updatePacketId": "e28fc19b-69ec-4504-b77b-a4e0cca6ef46"
        }
      ]
    },
    "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"
        }
      ]
    },
    "summary": {
      "title": "Summary Schema",
      "type": "object",
      "required": [
        "shots",
        "result",
        "scorer",
        "matchPoint",
        "setPoint",
        "breakPoint",
        "decidingPoint",
        "gamePoint",
        "tiebreak",
        "finalSet",
        "finalSetATieBreak",
        "teamToLeftOfUmpire",
        "teamAtPositiveX",
        "server",
        "receiver",
        "conclusion",
        "serve",
        "playersDistanceTravelled",
        "match",
        "sets",
        "game"
      ],
      "additionalProperties": false,
      "properties": {
        "shots": {
          "description": "The number of hit events during the packet",
          "type": "integer"
        },
        "result": {
          "description": "How the packet ended. Possible values include:\nPlayed - Action that ends the rally and advances the score. \nFault - Action that ends the rally and may or may not advance the score.\nLet (It Be Played Again) - Action that causes the rally to be replayed.\nTimeViolation - Delay that skips the rally and may or may not advance the score. If the scorer is not set, the violation was either a warning or occurred on the first serve.\nCodeViolation - Misconduct that skips the rally and may or may not advance the score. If the scorer is not set, the violation was a warning.",
          "enum": [
            "Played",
            "Fault",
            "Let",
            "TimeViolation",
            "CodeViolation"
          ]
        },
        "reason": {
          "description": "Extra details, if known, to help explain the result.",
          "enum": [
            "Ace",
            "BodyTouch",
            "NetTouch",
            "DoubleTouch",
            "RacketThrow",
            "NotYetOver",
            "NotUp",
            "Hindrance",
            "FootFault",
            "ServiceFault",
            "Net",
            "Balk",
            "Overrule",
            "NonMedicalLossOfCondition",
            "StartOfPlay",
            "UnreasonableDelay",
            "AudibleObscenity",
            "VisibleObscenity",
            "Coaching",
            "BallAbuse",
            "RacketAbuse",
            "VerbalAbuse",
            "PhysicalAbuse",
            "UnsportsmanlikeConduct",
            "BestEffort"
          ]
        },
        "scorer": {
          "description": "The team which scored",
          "type": "integer",
          "minimum": 1
        },
        "matchPoint": {
          "description": "Did a match point occur",
          "type": "boolean"
        },
        "setPoint": {
          "description": "Did a set point occur",
          "type": "boolean"
        },
        "breakPoint": {
          "description": "Did a break point occur",
          "type": "boolean"
        },
        "decidingPoint": {
          "description": "Did a deciding point occur",
          "type": "boolean"
        },
        "gamePoint": {
          "description": "Did a game point occur",
          "type": "boolean"
        },
        "tiebreak": {
          "description": "Did a tie break occur",
          "type": "boolean"
        },
        "finalSet": {
          "description": "Was it a final set",
          "type": "boolean"
        },
        "finalSetATieBreak": {
          "description": "Was it s final set at tie break",
          "type": "boolean"
        },
        "teamToLeftOfUmpire": {
          "description": "Which team was to the left of the umpire",
          "type": "integer",
          "minimum": 1
        },
        "teamAtPositiveX": {
          "description": "Which team was at positive X",
          "type": "integer",
          "minimum": 1
        },
        "server": {
          "description": "The team player who served",
          "$ref": "#/$defs/teamPlayer"
        },
        "receiver": {
          "description": "The team player who received the serve",
          "$ref": "#/$defs/teamPlayer"
        },
        "conclusion": {
          "description": "The conclusion of the summary",
          "$ref": "#/$defs/conclusion"
        },
        "serve": {
          "description": "Information about the serve",
          "$ref": "#/$defs/serve"
        },
        "playersDistanceTravelled": {
          "description": "Distance each of the players travelled",
          "type": "array",
          "items": {
            "$ref": "#/$defs/teamPlayerDistanceTravelled"
          }
        },
        "match": {
          "description": "Summary about the match so far",
          "$ref": "#/$defs/blockSummary"
        },
        "sets": {
          "description": "Summary about the sets so far",
          "type": "array",
          "items": {
            "$ref": "#/$defs/blockSummary"
          }
        },
        "game": {
          "description": "Summary about the game so far",
          "$ref": "#/$defs/gameSummary"
        }
      },
      "examples": [
        {
          "shots": 2,
          "result": "Played",
          "scorer": 2,
          "server": {
            "team": 2,
            "player": 1
          },
          "receiver": {
            "team": 1,
            "player": 1
          },
          "conclusion": {
            "stroke": "Backhand",
            "result": "Error",
            "action": "Forced",
            "eventId": "698bb76a-6df7-352f-88c8-6610f6b0d150",
            "speed": 71.193
          },
          "serve": {
            "eventId": "d2dd6483-fe40-3cf9-9cc3-059aae7e73b2",
            "side": "Advantage",
            "speed": 98.213
          },
          "playersDistanceTravelled": [
            {
              "team": 1,
              "player": 1,
              "distance": 5.197
            },
            {
              "team": 2,
              "player": 1,
              "distance": 8.624
            }
          ],
          "match": {
            "start": "2020-09-13T20:16:57.175Z",
            "duration": 170,
            "sets": {
              "team1": 2,
              "team2": 1
            },
            "games": {
              "team1": 19,
              "team2": 17
            },
            "points": {
              "team1": 119,
              "team2": 116
            }
          },
          "sets": [
            {
              "start": "2020-09-13T20:16:57.175Z",
              "end": "2020-09-13T20:47:26.688Z",
              "duration": 30,
              "games": {
                "team1": 6,
                "team2": 2
              },
              "tiebreak": {
                "team1": 0,
                "team2": 0
              },
              "points": {
                "team1": 29,
                "team2": 17
              }
            },
            {
              "start": "2020-09-13T20:49:57.128Z",
              "end": "2020-09-13T21:36:04.457Z",
              "duration": 46,
              "games": {
                "team1": 6,
                "team2": 4
              },
              "tiebreak": {
                "team1": 0,
                "team2": 0
              },
              "points": {
                "team1": 39,
                "team2": 34
              }
            },
            {
              "start": "2020-09-13T21:38:32.196Z",
              "end": "2020-09-13T22:26:40.248Z",
              "duration": 48,
              "games": {
                "team1": 4,
                "team2": 6
              },
              "tiebreak": {
                "team1": 0,
                "team2": 0
              },
              "points": {
                "team1": 32,
                "team2": 36
              }
            },
            {
              "start": "2020-09-13T22:29:44.602Z",
              "duration": 37,
              "games": {
                "team1": 3,
                "team2": 5
              },
              "tiebreak": {
                "team1": 0,
                "team2": 0
              },
              "points": {
                "team1": 19,
                "team2": 29
              }
            }
          ],
          "game": {
            "start": "2020-09-13T23:06:52.165Z",
            "duration": 0,
            "team1Score": "0",
            "team2Score": "15"
          },
          "scenarios": {
            "matchPoint": false,
            "setPoint": false,
            "breakPoint": false,
            "decidingPoint": false,
            "gamePoint": false,
            "tiebreak": false,
            "finalSet": false,
            "finalSetATieBreak": false
          },
          "teamToLeftOfUmpire": 2,
          "teamAtPositiveX": 2
        }
      ]
    },
    "teamPlayer": {
      "title": "Team Player Schema",
      "type": "object",
      "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
        }
      },
      "required": [
        "team",
        "player"
      ],
      "examples": [
        {
          "team": 2,
          "player": 1
        }
      ]
    },
    "conclusion": {
      "title": "Summary Conclusion Schema",
      "type": "object",
      "required": [
        "stroke",
        "result",
        "action",
        "eventId",
        "speed"
      ],
      "additionalProperties": false,
      "properties": {
        "stroke": {
          "description": "How the concluding shot was hit, if known. Possible values include:\nForehand\nBackhand",
          "enum": [
            "Forehand",
            "Backhand"
          ]
        },
        "result": {
          "description": "The outcome concluding the shot. Possible values include: \n\nWinner - The shot was successfully hit without the other team touching it before it became dead, therefore ending the rally. \nError - The shot was unsuccessfully hit, therefore ending the rally.",
          "enum": [
            "Winner",
            "Error"
          ]
        },
        "action": {
          "description": "Extra data to describe the result. Possible values include: \nEarned\nUnearned\nForced\nUnforced",
          "enum": [
            "Earned",
            "Unearned",
            "Forced",
            "Unforced"
          ]
        },
        "eventId": {
          "description": "The event ID to the arc information",
          "type": "string",
          "format": "uuid"
        },
        "speed": {
          "description": "The speed of the concluding shot",
          "type": "number",
          "minimum": 0
        }
      },
      "examples": [
        {
          "stroke": "Backhand",
          "result": "Error",
          "action": "Forced",
          "eventId": "698bb76a-6df7-352f-88c8-6610f6b0d150",
          "speed": 71.193
        }
      ]
    },
    "serve": {
      "title": "Serve Schema",
      "type": "object",
      "required": [
        "eventId",
        "side",
        "speed"
      ],
      "additionalProperties": false,
      "properties": {
        "eventId": {
          "description": "The event ID to the arc information",
          "type": "string",
          "format": "uuid"
        },
        "side": {
          "description": "The service box into which the server is serving. Possible values include:\nDeuce\nAdvantage",
          "enum": [
            "Deuce",
            "Advantage"
          ]
        },
        "speed": {
          "description": "The speed of the serve",
          "type": "number",
          "minimum": 0
        }
      },
      "examples": [
        {
          "eventId": "d2dd6483-fe40-3cf9-9cc3-059aae7e73b2",
          "side": "Advantage",
          "speed": 98.213
        }
      ]
    },
    "teamPlayerDistanceTravelled": {
      "title": "Team Player Distance Travelled Schema",
      "type": "object",
      "required": [
        "team",
        "player",
        "distance"
      ],
      "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
        },
        "distance": {
          "description": "The distance travelled by the team player",
          "type": "number",
          "minimum": 0
        }
      },
      "examples": [
        {
          "team": 1,
          "player": 1,
          "distance": 5.197
        },
        {
          "team": 2,
          "player": 1,
          "distance": 8.624
        }
      ]
    },
    "teamsTotal": {
      "title": "Teams Total Schema",
      "description": "Describes a total in some context for team 1 and team 2",
      "type": "object",
      "required": [
        "team1",
        "team2"
      ],
      "additionalProperties": false,
      "properties": {
        "team1": {
          "description": "The total for team 1",
          "type": "integer",
          "minimum": 0
        },
        "team2": {
          "description": "The total for team 2",
          "type": "integer",
          "minimum": 0
        }
      },
      "examples": [
        {
          "team1": 2,
          "team2": 1
        }
      ]
    },
    "blockSummary": {
      "title": "Block Summary Schema",
      "description": "Describes a summary of a block of data in a context",
      "type": "object",
      "required": [
        "start",
        "duration",
        "games",
        "points"
      ],
      "additionalProperties": false,
      "properties": {
        "start": {
          "description": "The starting timestamp this block summarises",
          "type": "string",
          "format": "date-time"
        },
        "end": {
          "description": "The ending timestamp this block summarises",
          "type": "string",
          "format": "date-time"
        },
        "duration": {
          "description": "The duration this block summarises in seconds",
          "type": "integer",
          "minimum": 0
        },
        "games": {
          "description": "The teams total of games summarised in this block",
          "$ref": "#/$defs/teamsTotal"
        },
        "sets": {
          "description": "The teams total of sets summarised in this block",
          "$ref": "#/$defs/teamsTotal"
        },
        "tiebreak": {
          "description": "The teams total of tiebreaks summarised in this block",
          "$ref": "#/$defs/teamsTotal"
        },
        "points": {
          "description": "The teams total of points summarised in this block",
          "$ref": "#/$defs/teamsTotal"
        }
      },
      "examples": [
        {
          "start": "2020-09-13T20:16:57.175Z",
          "end": "2020-09-13T20:47:26.688Z",
          "duration": 30,
          "games": {
            "team1": 6,
            "team2": 2
          },
          "tiebreak": {
            "team1": 0,
            "team2": 0
          },
          "points": {
            "team1": 29,
            "team2": 17
          }
        },
        {
          "start": "2020-09-13T20:16:57.175Z",
          "duration": 170,
          "sets": {
            "team1": 2,
            "team2": 1
          },
          "games": {
            "team1": 19,
            "team2": 17
          },
          "points": {
            "team1": 119,
            "team2": 116
          }
        }
      ]
    },
    "gameSummary": {
      "title": "Game Schema",
      "desciption": "Describes information about the game so far",
      "type": "object",
      "required": [
        "start",
        "duration",
        "team1Score",
        "team2Score"
      ],
      "additionalProperties": false,
      "properties": {
        "start": {
          "description": "The starting timestamp this summarises",
          "type": "string",
          "format": "date-time"
        },
        "end": {
          "description": "The ending timestamp this summarises",
          "type": "string",
          "format": "date-time"
        },
        "duration": {
          "description": "The duration this summarises in seconds",
          "type": "integer",
          "minimum": 0
        },
        "team1Score": {
          "description": "The current score for team 1",
          "enum": [
            "0",
            "15",
            "30",
            "40",
            "Ad"
          ]
        },
        "team2Score": {
          "description": "The current score for team 2",
          "enum": [
            "0",
            "15",
            "30",
            "40",
            "Ad"
          ]
        }
      },
      "examples": [
        {
          "start": "2020-09-13T23:06:52.165Z",
          "duration": 0,
          "team1Score": "0",
          "team2Score": "15"
        }
      ]
    }
  },
  "examples": [
    {
      "created": "2022-08-14T06:10:23.4908526Z",
      "id": "e28fc19b-69ec-4504-b77b-a4e0cca6ef46",
      "type": "live.tracking.summary",
      "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"
          }
        ]
      },
      "summary": {
        "shots": 2,
        "result": "Played",
        "scorer": 2,
        "matchPoint": false,
        "setPoint": false,
        "breakPoint": false,
        "decidingPoint": false,
        "gamePoint": false,
        "tiebreak": false,
        "finalSet": false,
        "finalSetATieBreak": false,
        "teamToLeftOfUmpire": 2,
        "teamAtPositiveX": 2,
        "server": {
          "team": 2,
          "player": 1
        },
        "receiver": {
          "team": 1,
          "player": 1
        },
        "conclusion": {
          "stroke": "Backhand",
          "result": "Error",
          "action": "Forced",
          "eventId": "698bb76a-6df7-352f-88c8-6610f6b0d150",
          "speed": 71.193
        },
        "serve": {
          "eventId": "d2dd6483-fe40-3cf9-9cc3-059aae7e73b2",
          "side": "Advantage",
          "speed": 98.213
        },
        "playersDistanceTravelled": [
          {
            "team": 1,
            "player": 1,
            "distance": 5.197
          },
          {
            "team": 2,
            "player": 1,
            "distance": 8.624
          }
        ],
        "match": {
          "start": "2020-09-13T20:16:57.175Z",
          "duration": 170,
          "sets": {
            "team1": 2,
            "team2": 1
          },
          "games": {
            "team1": 19,
            "team2": 17
          },
          "points": {
            "team1": 119,
            "team2": 116
          }
        },
        "sets": [
          {
            "start": "2020-09-13T20:16:57.175Z",
            "end": "2020-09-13T20:47:26.688Z",
            "duration": 30,
            "games": {
              "team1": 6,
              "team2": 2
            },
            "tiebreak": {
              "team1": 0,
              "team2": 0
            },
            "points": {
              "team1": 29,
              "team2": 17
            }
          },
          {
            "start": "2020-09-13T20:49:57.128Z",
            "end": "2020-09-13T21:36:04.457Z",
            "duration": 46,
            "games": {
              "team1": 6,
              "team2": 4
            },
            "tiebreak": {
              "team1": 0,
              "team2": 0
            },
            "points": {
              "team1": 39,
              "team2": 34
            }
          },
          {
            "start": "2020-09-13T21:38:32.196Z",
            "end": "2020-09-13T22:26:40.248Z",
            "duration": 48,
            "games": {
              "team1": 4,
              "team2": 6
            },
            "tiebreak": {
              "team1": 0,
              "team2": 0
            },
            "points": {
              "team1": 32,
              "team2": 36
            }
          },
          {
            "start": "2020-09-13T22:29:44.602Z",
            "duration": 37,
            "games": {
              "team1": 3,
              "team2": 5
            },
            "tiebreak": {
              "team1": 0,
              "team2": 0
            },
            "points": {
              "team1": 19,
              "team2": 29
            }
          }
        ],
        "game": {
          "start": "2020-09-13T23:06:52.165Z",
          "duration": 0,
          "team1Score": "0",
          "team2Score": "15"
        }
      }
    }
  ]
}
