{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mantismusic.app/docs/schemas/1.7/canimus.schema.json",
  "title": "canimus.json as Mantis writes it: the Canimus form of Chorus (github.com/PlaidWeb/Canimus) that Fairplayer reads, checked against Fairplayer's canimus/models.py (dates are full YYYY-MM-DD; entities have a url or uid).",
  "type": "object",
  "required": [
    "type",
    "version",
    "url",
    "children"
  ],
  "properties": {
    "type": {
      "const": "root"
    },
    "version": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "pattern": "^https?://"
    },
    "uid": {
      "type": "string"
    },
    "updated_date": {
      "$ref": "#/$defs/date"
    },
    "links": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/link"
      }
    },
    "children": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/artist"
      }
    }
  },
  "$defs": {
    "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "url": {
      "type": "string",
      "pattern": "^https?://"
    },
    "image": {
      "type": "object",
      "required": [
        "src"
      ],
      "properties": {
        "src": {
          "type": "string",
          "pattern": "^https?://"
        },
        "alt": {
          "type": "string"
        }
      }
    },
    "link": {
      "type": "object",
      "required": [
        "href"
      ],
      "properties": {
        "href": {
          "type": "string",
          "pattern": "^https?://"
        },
        "name": {
          "type": "string"
        },
        "rel": {
          "type": "string"
        }
      }
    },
    "artist": {
      "type": "object",
      "required": [
        "type",
        "name",
        "url",
        "children"
      ],
      "properties": {
        "type": {
          "const": "artist"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "pattern": "^https?://"
        },
        "uid": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "images": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/image"
          }
        },
        "links": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/link"
          }
        },
        "children": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "album",
                  "track"
                ]
              }
            }
          }
        }
      }
    },
    "album": {
      "type": "object",
      "required": [
        "type",
        "name",
        "url",
        "uid",
        "children"
      ],
      "properties": {
        "type": {
          "const": "album"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "pattern": "^https?://"
        },
        "uid": {
          "type": "string"
        },
        "artist": {
          "type": "string"
        },
        "release_date": {
          "$ref": "#/$defs/date"
        },
        "images": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/image"
          }
        },
        "description": {
          "type": "string"
        },
        "children": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/track"
          }
        }
      }
    },
    "track": {
      "type": "object",
      "required": [
        "type",
        "name",
        "uid",
        "duration",
        "media"
      ],
      "properties": {
        "type": {
          "const": "track"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "pattern": "^https?://"
        },
        "uid": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "artist": {
          "type": "string"
        },
        "album": {
          "type": "string"
        },
        "track": {
          "type": "integer",
          "minimum": 1
        },
        "release_date": {
          "$ref": "#/$defs/date"
        },
        "duration": {
          "type": "number",
          "minimum": 0
        },
        "description": {
          "type": "string"
        },
        "images": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/image"
          }
        },
        "genre": {
          "type": "string"
        },
        "lyrics": {
          "type": "string"
        },
        "composer": {
          "type": "string"
        },
        "lyricist": {
          "type": "string"
        },
        "media": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "type",
              "src"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "src": {
                "type": "string",
                "pattern": "^https?://"
              },
              "size": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}
