{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mantismusic.app/docs/schemas/1.4/chorus.schema.json",
  "title": "chorus.json as Mantis writes it: the parts of Chorus 0.3.2 (github.com/PlaidWeb/Chorus, format.md) Mantis uses. Chorus has no schema of its own yet; entity references ($ref) are checked by the tests.",
  "type": "object",
  "required": ["$type", "$protocol", "$version", "$items"],
  "properties": {
    "$type": { "const": "collection" },
    "$protocol": { "const": "Chorus" },
    "$version": { "type": "string", "pattern": "^0\\.3\\.\\d+$" },
    "lastModified": { "$ref": "#/$defs/datetime" },
    "$items": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/artist" } }
  },
  "$defs": {
    "id": { "type": "string", "pattern": "^[A-Za-z0-9:/?#\\[\\]@!$'()*+,;=._~%-]+$" },
    "url": { "type": "string", "pattern": "^https?://" },
    "date": { "type": "string", "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$" },
    "datetime": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?[+-]\\d{4}$" },
    "html": { "type": "string" },
    "image": {
      "type": "object",
      "required": ["src"],
      "properties": { "src": { "$ref": "#/$defs/url" }, "alt": { "type": "string" }, "contentType": { "type": "string", "pattern": "^image/" } }
    },
    "images": {
      "type": "object",
      "properties": {
        "main": { "type": "array", "items": { "$ref": "#/$defs/image" } },
        "thumb": { "type": "array", "items": { "$ref": "#/$defs/image" } },
        "poster": { "type": "array", "items": { "$ref": "#/$defs/image" } }
      }
    },
    "link": {
      "type": "object",
      "required": ["name", "href"],
      "properties": { "name": { "type": "string", "minLength": 1 }, "href": { "$ref": "#/$defs/url" }, "rel": { "type": "string" }, "contentType": { "type": "string" } }
    },
    "tag": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string", "minLength": 1 }, "rel": { "type": "string" } } },
    "artist": {
      "type": "object",
      "required": ["$type", "$id", "name", "$items"],
      "properties": {
        "$type": { "const": "artist" },
        "$id": { "$ref": "#/$defs/id" },
        "name": { "type": "string", "minLength": 1 },
        "url": { "$ref": "#/$defs/url" },
        "summary": { "type": "string" },
        "description": { "$ref": "#/$defs/html" },
        "images": { "$ref": "#/$defs/images" },
        "links": { "type": "array", "items": { "$ref": "#/$defs/link" } },
        "$items": { "type": "array", "items": { "$ref": "#/$defs/releaseOrTrack" } }
      }
    },
    "releaseOrTrack": {
      "type": "object",
      "properties": {
        "$type": { "enum": ["release", "track"] },
        "$id": { "$ref": "#/$defs/id" },
        "$ref": { "$ref": "#/$defs/id" },
        "name": { "type": "string", "minLength": 1 },
        "url": { "$ref": "#/$defs/url" },
        "releaseDate": { "$ref": "#/$defs/date" },
        "description": { "$ref": "#/$defs/html" },
        "images": { "$ref": "#/$defs/images" },
        "links": { "type": "array", "items": { "$ref": "#/$defs/link" } },
        "tags": { "type": "array", "items": { "$ref": "#/$defs/tag" } },
        "$items": { "type": "array", "items": { "$ref": "#/$defs/releaseOrTrack" } },
        "duration": { "type": "number", "minimum": 0 },
        "media": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["src", "contentType"],
            "properties": { "src": { "$ref": "#/$defs/url" }, "contentType": { "type": "string", "pattern": "^audio/" },
                            "size": { "type": "integer", "minimum": 0 }, "description": { "type": "string" } }
          }
        },
        "lyrics": { "type": "string" },
        "synchronizedLyrics": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["startTime", "text"],
            "properties": { "startTime": { "type": "number", "minimum": 0 }, "duration": { "type": "number", "minimum": 0 },
                            "voice": { "type": "string" }, "text": { "type": "string" } }
          }
        },
        "markers": {
          "type": "array",
          "items": { "type": "object", "required": ["startTime", "text"],
                     "properties": { "startTime": { "type": "number", "minimum": 0 }, "text": { "type": "string" }, "rel": { "type": "string" } } }
        },
        "credits": {
          "type": "array",
          "items": { "type": "object", "required": ["name", "roles"],
                     "properties": { "name": { "type": "string" }, "roles": { "type": "array", "items": { "type": "string" } } } }
        },
        "mantis": { "type": "object" }
      }
    }
  }
}
