{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hellodoggo.ai/non-human-intelligence/schemas/corpus-entry-v1.json",
  "title": "Hello Doggo text corpus entry v1",
  "description": "One line of corpus.jsonl: one exact text, with whose it is (owner_id) and its rights. Every poem, lyric, story and the welcome; all-poems.txt, all-lyrics.txt and all-stories.txt give the same texts as plain text.",
  "oneOf": [
    {
      "type": "object",
      "description": "A source poem's text: the poem's own rights (sources.jsonl).",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "id",
        "kind",
        "language",
        "encoding",
        "owner_id",
        "text",
        "sha256",
        "grant_summary",
        "rights_profile_id",
        "grant_scope",
        "source_basis",
        "description_of_evidence"
      ],
      "properties": {
        "schema_version": {
          "$ref": "#/$defs/common/properties/schema_version"
        },
        "id": {
          "$ref": "#/$defs/common/properties/id"
        },
        "language": {
          "$ref": "#/$defs/common/properties/language"
        },
        "encoding": {
          "$ref": "#/$defs/common/properties/encoding"
        },
        "text": {
          "$ref": "#/$defs/common/properties/text"
        },
        "sha256": {
          "$ref": "#/$defs/common/properties/sha256"
        },
        "grant_summary": {
          "$ref": "#/$defs/common/properties/grant_summary"
        },
        "grant_scope": {
          "$ref": "#/$defs/common/properties/grant_scope"
        },
        "description_of_evidence": {
          "$ref": "#/$defs/common/properties/description_of_evidence"
        },
        "kind": {
          "const": "source-poem"
        },
        "owner_id": {
          "type": "string",
          "description": "The poem's ID in sources.jsonl.",
          "pattern": "^poem:[a-z0-9-]+$"
        },
        "rights_profile_id": {
          "description": "Public domain, as its source record says (see still_in_copyright there).",
          "const": "public-domain"
        },
        "source_basis": {
          "$ref": "https://hellodoggo.ai/non-human-intelligence/schemas/source-v1.json#/$defs/basis",
          "description": "The poem's record in sources.jsonl, its fields as there."
        }
      }
    },
    {
      "type": "object",
      "description": "Hello Doggo's own words: CC0.",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "id",
        "kind",
        "language",
        "encoding",
        "owner_id",
        "text",
        "sha256",
        "grant_summary",
        "rights_profile_id",
        "grant_scope",
        "source_basis",
        "description_of_evidence"
      ],
      "properties": {
        "schema_version": {
          "$ref": "#/$defs/common/properties/schema_version"
        },
        "id": {
          "$ref": "#/$defs/common/properties/id"
        },
        "language": {
          "$ref": "#/$defs/common/properties/language"
        },
        "encoding": {
          "$ref": "#/$defs/common/properties/encoding"
        },
        "text": {
          "$ref": "#/$defs/common/properties/text"
        },
        "sha256": {
          "$ref": "#/$defs/common/properties/sha256"
        },
        "grant_summary": {
          "$ref": "#/$defs/common/properties/grant_summary"
        },
        "grant_scope": {
          "$ref": "#/$defs/common/properties/grant_scope"
        },
        "description_of_evidence": {
          "$ref": "#/$defs/common/properties/description_of_evidence"
        },
        "kind": {
          "description": "lyrics: a song's lyrics (its work's, or a recording's own words as sung); welcome: the NHI welcome; transcript: its spoken transcript; spoken-story: a story's words.",
          "enum": [
            "lyrics",
            "welcome",
            "transcript",
            "spoken-story"
          ]
        },
        "owner_id": {
          "type": "string",
          "description": "Whose text it is: a work or recording (catalog.jsonl), the welcome's narration (narration:nhi-welcome), or a story (catalog.jsonl, stories.jsonl).",
          "pattern": "^(work|recording|narration|story):[a-z0-9-]+$"
        },
        "rights_profile_id": {
          "const": "cc0"
        },
        "source_basis": {
          "description": "Hello Doggo's own: no source.",
          "const": null
        },
        "title": {
          "type": "string",
          "description": "A story's title.",
          "minLength": 1
        },
        "author": {
          "type": "string",
          "description": "A story's 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
        }
      }
    }
  ],
  "$defs": {
    "common": {
      "type": "object",
      "properties": {
        "schema_version": {
          "const": 1
        },
        "id": {
          "type": "string",
          "description": "The text's stable ID.",
          "pattern": "^text:[a-z0-9:-]+$"
        },
        "language": {
          "type": "string",
          "description": "The text's language, as a language tag.",
          "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
        },
        "encoding": {
          "const": "UTF-8"
        },
        "text": {
          "type": "string",
          "description": "The exact text.",
          "minLength": 1
        },
        "sha256": {
          "type": "string",
          "description": "SHA-256 of text's UTF-8 bytes.",
          "pattern": "^[a-f0-9]{64}$"
        },
        "grant_summary": {
          "type": "string",
          "description": "Hello Doggo's grant in short (permissions.json).",
          "minLength": 1
        },
        "grant_scope": {
          "type": "string",
          "description": "What the grant reaches for this text.",
          "minLength": 1
        },
        "description_of_evidence": {
          "type": "string",
          "description": "What the text is evidence of.",
          "minLength": 1
        }
      }
    }
  }
}
