{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://library.mrm.org/schema/work-index.schema.json",
  "title": "Work index.md frontmatter",
  "description": "Frontmatter of content/<work>/index.md: the metadata shared by every part and section of a work. Sections inherit it (nearest value wins); twins and JSON carry the resolved result.",
  "type": "object",
  "required": [
    "title",
    "type",
    "language",
    "rights"
  ],
  "additionalProperties": false,
  "properties": {
    "authors": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/people"
    },
    "translators": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "editors": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "publisher": {
      "type": "string",
      "minLength": 1
    },
    "publisher_place": {
      "type": "string"
    },
    "publisher_note": {
      "type": "string"
    },
    "published": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/date"
    },
    "edition": {
      "type": "string"
    },
    "language": {
      "type": "string",
      "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]+)*$"
    },
    "rights": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/rights"
    },
    "source": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/source"
    },
    "curator_note": {
      "type": "string"
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "abbr": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "description": "One neutral sentence, in the site's own neutral voice."
    },
    "aliases": {
      "type": "array",
      "items": {
        "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
      },
      "description": "Earlier slugs; the Worker 301-redirects them to the current one."
    },
    "type": {
      "enum": [
        "book",
        "article",
        "letter",
        "poem",
        "speech",
        "pamphlet",
        "magazine",
        "periodical",
        "creed",
        "edition-set",
        "other"
      ]
    },
    "format": {
      "enum": [
        "magazine",
        "journal",
        "newspaper"
      ]
    },
    "collections": {
      "type": "array",
      "items": {
        "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
      },
      "uniqueItems": true
    },
    "topics": {
      "type": "array",
      "items": {
        "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
      },
      "uniqueItems": true
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "series": {
      "type": "object",
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
        },
        "position": {
          "type": "integer"
        }
      }
    },
    "status": {
      "enum": [
        "complete",
        "partial"
      ]
    },
    "ref_style": {
      "enum": [
        "volume-page",
        "book-chapter-verse",
        "chapter-section",
        "page"
      ]
    },
    "edition_of": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
    },
    "translation_of": {
      "$ref": "https://library.mrm.org/schema/common.schema.json#/$defs/slug"
    },
    "periodical": {
      "type": "string"
    },
    "cover": {
      "type": "string"
    },
    "image": {
      "type": "object",
      "required": [
        "file",
        "alt",
        "source",
        "host",
        "creator",
        "date",
        "basis"
      ],
      "additionalProperties": false,
      "description": "The work's own picture (a public-domain title page or cover), shown in the home list, on the work page, in JSON-LD and as the Open Graph image; without it the first author's portrait, then initials. The file is public/works/<file>-{96,192,512}.webp (scripts/make-work-images.mjs).",
      "properties": {
        "file": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        },
        "alt": {
          "type": "string",
          "minLength": 1,
          "description": "Descriptive alt text for the work page; lists treat the picture as decorative."
        },
        "kind": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "format": "uri"
        },
        "host": {
          "type": "string"
        },
        "creator": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "basis": {
          "type": "string",
          "minLength": 20,
          "description": "Why the image is in the public domain."
        }
      }
    }
  }
}
