{
  "$id": "/insights/highlight",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "a section of the video that stands out",
  "else": {
    "else": {
      "else": {
        "else": {
          "if": {
            "properties": {
              "kind": {
                "const": "sequence"
              }
            }
          },
          "then": {
            "properties": {
              "events": {
                "description": "specific highlighted events",
                "items": {
                  "else": {
                    "else": {
                      "if": {
                        "properties": {
                          "kind": {
                            "const": "shot"
                          }
                        }
                      },
                      "then": {
                        "properties": {
                          "shot_type": {
                            "description": "- smash: an overhead or similar shot where the ball goes from high to low (no upward motion)\n- lob: a shot with a relatively high peak\n- dink: a shot that would land in or near the kitchen and which was hit from near the kitchen\n- drop: a shot that would land in or near the kitchen and was hit from the transition zone or deeper\n- drive: a shot that would land deep if not stopped by an opponent's paddle, opponent's body, or the net (and doesn't fall into an earlier categorization)\n- atp: an around-the-post shot, where the ball is hit outside the sideline and around the net post instead of over the net\n- erne: a shot hit from outside the sideline by the kitchen (based on when the player's feet first touch after a volley)\n\nOmitted if we can't confidently determine a shot type based on the ball's trajectory and other characteristics.",
                            "enum": [
                              "smash",
                              "lob",
                              "dink",
                              "drop",
                              "drive",
                              "atp",
                              "erne"
                            ],
                            "type": "string"
                          }
                        }
                      }
                    },
                    "if": {
                      "properties": {
                        "kind": {
                          "const": "long_battle"
                        }
                      }
                    },
                    "then": {
                      "properties": {
                        "end_shot_idx": {
                          "description": "the shot number in the rally (0-indexed)",
                          "minimum": 0,
                          "type": "integer"
                        }
                      },
                      "required": [
                        "end_shot_idx"
                      ]
                    }
                  },
                  "if": {
                    "properties": {
                      "kind": {
                        "const": "firefight"
                      }
                    }
                  },
                  "properties": {
                    "kind": {
                      "enum": [
                        "firefight",
                        "long_battle",
                        "passing",
                        "poach",
                        "shot"
                      ],
                      "type": "string"
                    },
                    "ms": {
                      "$ref": "/types/video_time",
                      "description": "when in the original video the event happens",
                      "title": "Video Milliseconds"
                    },
                    "score": {
                      "description": "An absolute measure of quality, can go above 1",
                      "minimum": 0,
                      "title": "Highlight/Highlighted Event Score",
                      "type": "number"
                    },
                    "shot_idx": {
                      "description": "the shot number in the rally (0-indexed)",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "shot_idx",
                    "score",
                    "ms",
                    "kind"
                  ],
                  "then": {
                    "properties": {
                      "end_shot_idx": {
                        "description": "the shot number in the rally (0-indexed)",
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "end_shot_idx"
                    ]
                  },
                  "type": "object",
                  "unevaluatedProperties": false
                },
                "type": "array"
              },
              "rally_ending": {
                "type": "boolean"
              },
              "short_description": {
                "description": "a short description of the highlight",
                "type": "string"
              },
              "shot_end_idx": {
                "description": "the final shot index in the range, inclusive (0-indexed)",
                "minimum": 0,
                "type": "integer"
              },
              "shot_start_idx": {
                "description": "initiating shot of the highlight, can be just a mistake",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "shot_start_idx",
              "shot_end_idx",
              "rally_ending",
              "short_description",
              "events"
            ]
          }
        },
        "if": {
          "properties": {
            "kind": {
              "const": "poach"
            }
          }
        },
        "then": {
          "properties": {
            "shot_idx": {
              "description": "the shot number in the rally (0-indexed)",
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "shot_idx"
          ]
        }
      },
      "if": {
        "properties": {
          "kind": {
            "const": "hands_battle"
          }
        }
      },
      "then": {
        "properties": {
          "shot_end_idx": {
            "description": "the final shot index in the range, inclusive (0-indexed)",
            "minimum": 0,
            "type": "integer"
          },
          "shot_start_idx": {
            "description": "the shot index in which the initiating shot occurred (0-indexed)",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "shot_start_idx",
          "shot_end_idx"
        ]
      }
    },
    "if": {
      "properties": {
        "kind": {
          "const": "erne"
        }
      }
    },
    "then": {
      "properties": {
        "shot_idx": {
          "description": "the shot number in the rally (0-indexed)",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "shot_idx"
      ]
    }
  },
  "if": {
    "properties": {
      "kind": {
        "const": "atp"
      }
    }
  },
  "properties": {
    "e": {
      "$ref": "/types/video_time",
      "description": "when in the original video the highlight ends",
      "title": "Video Milliseconds"
    },
    "kind": {
      "enum": [
        "atp",
        "erne",
        "hands_battle",
        "long_rally",
        "poach",
        "sequence"
      ],
      "type": "string"
    },
    "md5_full": {
      "const": "9ca707e8b1f6c4a863ae7deae094f172",
      "description": "MD5 of the all aspects of this schema (including non-functional elements like documentation)"
    },
    "md5_functional": {
      "const": "da657053e81bee523da990b840fc7597",
      "description": "MD5 of the functional aspects of this schema"
    },
    "rally_idx": {
      "description": "which rally in the video this shot occurs (0-indexed)",
      "minimum": 0,
      "type": "integer"
    },
    "s": {
      "$ref": "/types/video_time",
      "description": "when in the original video the highlight starts",
      "title": "Video Milliseconds"
    },
    "score": {
      "description": "An absolute measure of quality, can go above 1",
      "minimum": 0,
      "title": "Highlight/Highlighted Event Score",
      "type": "number"
    }
  },
  "required": [
    "s",
    "e",
    "score",
    "rally_idx",
    "kind"
  ],
  "then": {
    "properties": {
      "shot_idx": {
        "description": "the shot number in the rally (0-indexed)",
        "minimum": 0,
        "type": "integer"
      }
    },
    "required": [
      "shot_idx"
    ]
  },
  "title": "Highlight",
  "type": "object",
  "unevaluatedProperties": false
}