{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://listenhere.ai/schemas/timed-lyrics.json",
  "title": "ListenHere timed lyrics v1",
  "description": "UTF-8 JSON, at most 1048576 bytes. All intervals are half-open canonical playback milliseconds: start_ms < end_ms <= recording duration. Words must lie within their cue. recording.id must equal the upload track_revision_id. Additional artist metadata is retained but not interpreted.",
  "type": "object",
  "required": [
    "document_type",
    "time_unit",
    "recording",
    "cues"
  ],
  "properties": {
    "document_type": {
      "const": "timed_lyrics"
    },
    "time_unit": {
      "const": "milliseconds"
    },
    "recording": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^trv_[a-f0-9]{32}$"
        }
      }
    },
    "cues": {
      "type": "array",
      "minItems": 1,
      "maxItems": 2000,
      "items": {
        "type": "object",
        "required": [
          "text",
          "start_ms",
          "end_ms",
          "role"
        ],
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "start_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10799999
          },
          "end_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10800000
          },
          "role": {
            "type": "string",
            "enum": [
              "lead",
              "harmony",
              "chop"
            ]
          },
          "words": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "type": "object",
              "required": [
                "text",
                "start_ms",
                "end_ms"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                },
                "start_ms": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10799999
                },
                "end_ms": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10800000
                }
              }
            }
          }
        }
      }
    }
  }
}
