{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://library.mrm.org/schema/work.schema.json",
  "title": "MRM Library resolved frontmatter (markdown twins and JSON)",
  "description": "Frontmatter as served in every markdown twin and JSON twin: the work's index.md, any parts' index.md and the section's own frontmatter merged (nearest value wins). Source files carry only differences; see work-index, part-index and section schemas.",
  "type": "object",
  "required": [
    "title",
    "authors",
    "publisher",
    "published",
    "language",
    "type",
    "reference",
    "rights"
  ],
  "additionalProperties": false,
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "description": "Title of the work (shared by all sections of the work)."
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "description": "One neutral sentence describing the work or issue; used for page descriptions and meta tags. Do not copy a source's self-description."
    },
    "authors": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      },
      "description": "Authors, 'Last, First' form."
    },
    "translators": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "editors": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "description": "Editors / revisers named by the edition, 'Last, First' form."
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true,
      "description": "Free-form facets (topic, series)."
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      },
      "uniqueItems": true,
      "description": "Collections (curated groupings) the work belongs to; not part of any URL."
    },
    "publisher": {
      "type": "string",
      "minLength": 1
    },
    "publisher_place": {
      "type": "string"
    },
    "publisher_note": {
      "type": "string",
      "description": "Caveats about the imprint as printed on the title page."
    },
    "published": {
      "type": "string",
      "pattern": "^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$",
      "description": "Year or ISO date of the edition used."
    },
    "edition": {
      "type": "string"
    },
    "language": {
      "type": "string",
      "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]+)*$",
      "description": "BCP 47 tag."
    },
    "type": {
      "enum": [
        "book",
        "article",
        "letter",
        "poem",
        "speech",
        "pamphlet",
        "magazine",
        "periodical",
        "creed",
        "edition-set",
        "other"
      ]
    },
    "chapter": {
      "type": "integer",
      "minimum": 1,
      "description": "Chapter number, for works that are divided into numbered chapters."
    },
    "verse_count": {
      "type": "integer",
      "minimum": 1,
      "description": "Number of numbered verses in this chapter."
    },
    "reference": {
      "type": "string",
      "minLength": 10,
      "description": "Chicago-style footnote citation for this section, including the URL of the source."
    },
    "source": {
      "type": "object",
      "required": [
        "url"
      ],
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL of the source as given by the importer (a scan, a PDF or a transcription page)."
        },
        "identifier": {
          "type": "string"
        },
        "scan": {
          "type": "string"
        },
        "transcription": {
          "type": "string"
        }
      }
    },
    "rights": {
      "type": "object",
      "required": [
        "status",
        "basis",
        "source"
      ],
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "public-domain",
            "permission",
            "cc-by",
            "cc-by-sa",
            "other"
          ]
        },
        "basis": {
          "type": "string",
          "minLength": 3,
          "description": "Why the status holds, e.g. '1867 US publication'."
        },
        "source": {
          "type": "string",
          "format": "uri",
          "description": "Where the status can be checked."
        },
        "note": {
          "type": "string"
        },
        "publication_year": {
          "type": "integer",
          "minimum": 1400,
          "description": "Year of first/US publication of the edition used. For public-domain works the build requires 1930 or earlier."
        }
      }
    },
    "periodical": {
      "type": "string",
      "description": "Periodical title, for issues and articles of a periodical."
    },
    "volume": {
      "type": "integer",
      "minimum": 1,
      "description": "Volume number of a periodical issue."
    },
    "number": {
      "type": "integer",
      "minimum": 1,
      "description": "Issue number within the volume."
    },
    "start_page": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "string",
          "minLength": 1
        }
      ],
      "description": "First printed page of this section in the source edition (Roman numerals allowed)."
    },
    "end_page": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "string",
          "minLength": 1
        }
      ],
      "description": "Last printed page of this section in the source edition."
    },
    "curator_note": {
      "type": "string",
      "description": "Provenance note from the importing curator (what was omitted, which scan was used)."
    },
    "reporter": {
      "type": "string",
      "description": "Who took down or transcribed the discourse (stenographer or newspaper), as printed."
    },
    "place": {
      "type": "string",
      "description": "Where a discourse was delivered, as printed in its heading (without date or event)."
    }
  }
}
