{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://library.mrm.org/schema/authors.schema.json",
  "title": "MRM Library authors (data/authors.json)",
  "type": "object",
  "required": [
    "authors"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string"
    },
    "authors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "sortName"
        ],
        "additionalProperties": false,
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "sortName": {
            "type": "string",
            "minLength": 1,
            "description": "As written in work frontmatter, e.g. 'Smith, Lucy'."
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Other forms of the name that work frontmatter may use."
          },
          "born": {
            "type": "integer"
          },
          "died": {
            "type": "integer"
          },
          "bio": {
            "type": "string",
            "description": "One neutral line."
          },
          "portrait": {
            "type": "object",
            "required": [
              "file",
              "source",
              "host",
              "creator",
              "date",
              "basis"
            ],
            "additionalProperties": false,
            "properties": {
              "file": {
                "type": "string",
                "description": "Base name of public/authors/<file>-96.webp and -192.webp."
              },
              "kind": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "format": "uri"
              },
              "host": {
                "type": "string"
              },
              "creator": {
                "type": "string"
              },
              "date": {
                "type": "string"
              },
              "basis": {
                "type": "string",
                "description": "Why the image may be used (public domain basis)."
              }
            }
          },
          "kind": {
            "enum": [
              "person",
              "organization"
            ],
            "default": "person"
          },
          "sameAs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Wikidata, VIAF, Wikipedia or other identifiers."
          }
        },
        "description": "An author record: a person or an organization. Works refer to it by slug in `authors:`; an unmatched plain name is also allowed in frontmatter."
      }
    }
  }
}
