{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://library.mrm.org/schema/index.schema.json",
  "title": "MRM Library /index.json",
  "description": "Machine-readable catalog: collections, authors and every work (works only: parts and sections are in each work's manifest, see node.schema.json). Works are listed oldest first.",
  "type": "object",
  "required": [
    "name",
    "url",
    "description",
    "collections",
    "works",
    "sections"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "description": {
      "type": "string"
    },
    "schemas": {
      "type": "object"
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "url",
          "index",
          "works",
          "sections"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "collection",
              "series"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "index": {
            "type": "string",
            "format": "uri"
          },
          "works": {
            "type": "integer"
          },
          "sections": {
            "type": "integer"
          }
        }
      }
    },
    "works": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "path",
          "title",
          "collections",
          "authors",
          "published",
          "sections",
          "url",
          "index",
          "rights"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "abbr": {
            "type": "string"
          },
          "collections": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "authors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "published": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "sections": {
            "type": "integer",
            "minimum": 1
          },
          "issues": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "index": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "rights": {
            "type": "object",
            "required": [
              "status",
              "basis",
              "source"
            ],
            "properties": {
              "status": {
                "type": "string"
              },
              "basis": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "publication_year": {
                "type": "integer"
              },
              "note": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "sections": {
      "type": "integer",
      "minimum": 0,
      "description": "Total number of sections (markdown files) in the library."
    },
    "authors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "url",
          "index",
          "works"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "person",
              "organization"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "index": {
            "type": "string",
            "format": "uri"
          },
          "works": {
            "type": "integer"
          }
        }
      }
    }
  }
}
