{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hellodoggo.ai/non-human-intelligence/schemas/catalog-entry-v2.json",
  "title": "Hello Doggo catalog entry v2",
  "description": "One line of catalog.jsonl: every work, recording, narration and story, with where to listen and its full record (manifest_url). IDs are stable: work:, recording:, narration:, story:.",
  "oneOf": [
    {
      "type": "object",
      "description": "A song as a work: its words and music, whatever the recording. Its recordings are listed in its manifest (recording_ids).",
      "additionalProperties": false,
      "required": [
        "status",
        "schema_version",
        "id",
        "title",
        "audio_url",
        "manifest_url",
        "entity_type",
        "poet"
      ],
      "properties": {
        "status": {
          "$ref": "#/$defs/fields/properties/status"
        },
        "schema_version": {
          "$ref": "#/$defs/fields/properties/schema_version"
        },
        "id": {
          "type": "string",
          "pattern": "^work:[a-z0-9-]+$"
        },
        "title": {
          "$ref": "#/$defs/fields/properties/title"
        },
        "audio_url": {
          "$ref": "#/$defs/fields/properties/audio_url"
        },
        "manifest_url": {
          "$ref": "#/$defs/fields/properties/manifest_url"
        },
        "entity_type": {
          "const": "musical-work"
        },
        "poet": {
          "$ref": "#/$defs/fields/properties/poet"
        },
        "note": {
          "$ref": "#/$defs/fields/properties/note"
        },
        "remix_of": {
          "$ref": "#/$defs/fields/properties/remix_of"
        },
        "inspired_by": {
          "$ref": "#/$defs/fields/properties/inspired_by"
        }
      }
    },
    {
      "type": "object",
      "description": "A recording of a song: a version or mix. Its manifest names its work.",
      "additionalProperties": false,
      "required": [
        "status",
        "schema_version",
        "id",
        "title",
        "audio_url",
        "manifest_url",
        "entity_type",
        "poet",
        "version_label",
        "release_memberships",
        "primary_release_id",
        "page_url",
        "scene_score",
        "duration_seconds",
        "duration_source"
      ],
      "properties": {
        "status": {
          "$ref": "#/$defs/fields/properties/status"
        },
        "schema_version": {
          "$ref": "#/$defs/fields/properties/schema_version"
        },
        "id": {
          "type": "string",
          "pattern": "^recording:[a-z0-9-]+$"
        },
        "title": {
          "$ref": "#/$defs/fields/properties/title"
        },
        "audio_url": {
          "$ref": "#/$defs/fields/properties/audio_url"
        },
        "manifest_url": {
          "$ref": "#/$defs/fields/properties/manifest_url"
        },
        "entity_type": {
          "const": "song-recording"
        },
        "poet": {
          "$ref": "#/$defs/fields/properties/poet"
        },
        "version_label": {
          "type": [
            "string",
            "null"
          ],
          "description": "Its mix or version name; null for the version with the plain title."
        },
        "release_memberships": {
          "type": "array",
          "description": "Every release it is on.",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "release_id",
              "title",
              "kind",
              "disc_number",
              "track_number",
              "page_url"
            ],
            "properties": {
              "release_id": {
                "type": "string",
                "description": "The release (releases.jsonl).",
                "pattern": "^release:[a-z0-9-]+$"
              },
              "title": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "enum": [
                  "album",
                  "ep",
                  "single"
                ]
              },
              "disc_number": {
                "type": "integer",
                "minimum": 1
              },
              "track_number": {
                "type": "integer",
                "minimum": 1
              },
              "page_url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "primary_release_id": {
          "type": "string",
          "description": "The release it is first listed under (releases.jsonl).",
          "pattern": "^release:[a-z0-9-]+$"
        },
        "page_url": {
          "type": "string",
          "description": "Its song page.",
          "format": "uri"
        },
        "scene_score": {
          "type": "object",
          "description": "Hello Doggo's own Energy and Tone ratings.",
          "additionalProperties": false,
          "required": [
            "energy",
            "tone",
            "definition_url"
          ],
          "properties": {
            "energy": {
              "type": "number",
              "minimum": 0
            },
            "tone": {
              "type": "number",
              "minimum": 0
            },
            "definition_url": {
              "type": "string",
              "description": "scene-scores.json: the scale and what it means.",
              "format": "uri"
            }
          }
        },
        "duration_seconds": {
          "$ref": "#/$defs/fields/properties/duration_seconds"
        },
        "duration_source": {
          "type": "string",
          "minLength": 1
        },
        "tempo_bpm": {
          "type": "integer",
          "description": "Its tempo in beats per minute: the owner's own measurement of the track's tempo.",
          "minimum": 1
        },
        "genre": {
          "type": "array",
          "description": "Its genre, where its version name gives one.",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "genre_source": {
          "type": "string",
          "minLength": 1
        },
        "note": {
          "$ref": "#/$defs/fields/properties/note"
        },
        "remix_of": {
          "$ref": "#/$defs/fields/properties/remix_of"
        },
        "inspired_by": {
          "$ref": "#/$defs/fields/properties/inspired_by"
        }
      }
    },
    {
      "type": "object",
      "description": "A poem read aloud by Hello Doggo.",
      "additionalProperties": false,
      "required": [
        "status",
        "schema_version",
        "id",
        "title",
        "audio_url",
        "manifest_url",
        "entity_type",
        "poet"
      ],
      "properties": {
        "status": {
          "$ref": "#/$defs/fields/properties/status"
        },
        "schema_version": {
          "$ref": "#/$defs/fields/properties/schema_version"
        },
        "id": {
          "type": "string",
          "pattern": "^narration:[a-z0-9-]+$"
        },
        "title": {
          "$ref": "#/$defs/fields/properties/title"
        },
        "audio_url": {
          "$ref": "#/$defs/fields/properties/audio_url"
        },
        "manifest_url": {
          "$ref": "#/$defs/fields/properties/manifest_url"
        },
        "entity_type": {
          "const": "poem-narration"
        },
        "poet": {
          "type": "string",
          "description": "The poem's poet (sources.jsonl author).",
          "minLength": 1
        }
      }
    },
    {
      "type": "object",
      "description": "The NHI welcome, spoken.",
      "additionalProperties": false,
      "required": [
        "status",
        "schema_version",
        "id",
        "title",
        "audio_url",
        "manifest_url",
        "entity_type",
        "poet"
      ],
      "properties": {
        "status": {
          "$ref": "#/$defs/fields/properties/status"
        },
        "schema_version": {
          "$ref": "#/$defs/fields/properties/schema_version"
        },
        "id": {
          "type": "string",
          "pattern": "^narration:[a-z0-9-]+$"
        },
        "title": {
          "$ref": "#/$defs/fields/properties/title"
        },
        "audio_url": {
          "$ref": "#/$defs/fields/properties/audio_url"
        },
        "manifest_url": {
          "$ref": "#/$defs/fields/properties/manifest_url"
        },
        "entity_type": {
          "const": "welcome-narration"
        },
        "poet": {
          "const": null
        }
      }
    },
    {
      "type": "object",
      "description": "A spoken story: Hello Doggo's own tale, told, not sung (stories.jsonl). Not music.",
      "additionalProperties": false,
      "required": [
        "status",
        "schema_version",
        "id",
        "title",
        "audio_url",
        "manifest_url",
        "entity_type",
        "author",
        "duration_seconds"
      ],
      "properties": {
        "status": {
          "$ref": "#/$defs/fields/properties/status"
        },
        "schema_version": {
          "$ref": "#/$defs/fields/properties/schema_version"
        },
        "id": {
          "type": "string",
          "pattern": "^story:[a-z0-9-]+$"
        },
        "title": {
          "$ref": "#/$defs/fields/properties/title"
        },
        "audio_url": {
          "$ref": "#/$defs/fields/properties/audio_url"
        },
        "manifest_url": {
          "$ref": "#/$defs/fields/properties/manifest_url"
        },
        "entity_type": {
          "const": "spoken-story"
        },
        "author": {
          "type": "string",
          "description": "Its author, Hello Doggo.",
          "minLength": 1
        },
        "subject_poet": {
          "type": "string",
          "description": "A Poetry Tale's subject: the poet it is about, never its author.",
          "minLength": 1
        },
        "duration_seconds": {
          "$ref": "#/$defs/fields/properties/duration_seconds"
        }
      }
    }
  ],
  "$defs": {
    "fields": {
      "type": "object",
      "properties": {
        "status": {
          "description": "Published: live on the site.",
          "const": "published"
        },
        "schema_version": {
          "const": 2
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "audio_url": {
          "type": "string",
          "description": "Where to listen first: an MP3 (a work's: its main recording's).",
          "format": "uri"
        },
        "manifest_url": {
          "type": "string",
          "description": "The entry's full record, with every file, text and rights: works/, recordings/ or stories/ <id>/manifest.json.",
          "format": "uri"
        },
        "poet": {
          "type": [
            "string",
            "null"
          ],
          "description": "The poet of the poem it sets or reads (sources.jsonl author); null for Hello Doggo's own songs and the welcome."
        },
        "note": {
          "type": "string",
          "description": "The line under its lyrics.",
          "minLength": 1
        },
        "remix_of": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "work_id",
            "title"
          ],
          "properties": {
            "work_id": {
              "type": "string",
              "description": "The work it remixes (catalog.jsonl).",
              "pattern": "^work:[a-z0-9-]+$"
            },
            "title": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "inspired_by": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "poem_id",
            "title",
            "author"
          ],
          "properties": {
            "poem_id": {
              "type": "string",
              "description": "The poem (sources.jsonl).",
              "pattern": "^poem:[a-z0-9-]+$"
            },
            "title": {
              "type": "string",
              "minLength": 1
            },
            "author": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "duration_seconds": {
          "type": "number",
          "description": "Its length.",
          "exclusiveMinimum": 0
        }
      }
    }
  }
}
