{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://logia.faith/downloads/logia-en.schema.json",
  "title": "Logia: the commentary excerpts, in English",
  "description": "Logia's public-domain commentary excerpts, each copied word for word from the source at source_url. See https://logia.faith/open-data/.",
  "type": "object",
  "required": [
    "about",
    "licence",
    "source",
    "authors",
    "works",
    "excerpts"
  ],
  "properties": {
    "about": {
      "type": "string"
    },
    "licence": {
      "const": "CC0-1.0"
    },
    "source": {
      "type": "string",
      "format": "uri"
    },
    "authors": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/author"
      }
    },
    "works": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/work"
      }
    },
    "excerpts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/excerpt"
      }
    }
  },
  "$defs": {
    "author": {
      "type": "object",
      "required": [
        "name",
        "dates",
        "died",
        "era",
        "tradition"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "dates": {
          "type": "string"
        },
        "died": {
          "type": "integer"
        },
        "era": {
          "enum": [
            "Early church",
            "Middle Ages",
            "Reformation",
            "Puritans and the 1700s",
            "The 1800s"
          ]
        },
        "tradition": {
          "type": "string"
        }
      }
    },
    "work": {
      "type": "object",
      "required": [
        "title",
        "author",
        "edition",
        "translation",
        "published",
        "full_text_url",
        "rights",
        "status"
      ],
      "properties": {
        "title": {
          "type": "string"
        },
        "author": {
          "type": "string"
        },
        "edition": {
          "type": "string"
        },
        "translation": {
          "type": [
            "string",
            "null"
          ]
        },
        "published": {
          "type": "integer"
        },
        "full_text_url": {
          "type": "string",
          "format": "uri"
        },
        "rights": {
          "type": "object",
          "required": [
            "basis"
          ],
          "properties": {
            "basis": {
              "type": "string"
            },
            "worldwide": {
              "type": "string"
            }
          }
        },
        "status": {
          "enum": [
            "ai_draft",
            "reviewed"
          ]
        }
      }
    },
    "excerpt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "work",
        "author",
        "start",
        "end",
        "heading",
        "text",
        "locus",
        "source_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The excerpt's permanent id: work, first verse and number (calvin.JHN.1.14.1). It never changes once published.",
          "pattern": "^[a-z0-9-]+\\.[1-3A-Z][A-Z0-9]{2}\\.[0-9]+\\.[0-9]+(-[0-9]+)?\\.[0-9]+$"
        },
        "work": {
          "type": "string",
          "description": "The commentary it comes from (calvin), as in library/works/."
        },
        "author": {
          "type": "string",
          "description": "The commentator (calvin), as in library/authors/."
        },
        "start": {
          "type": "string",
          "description": "The verses it comments on, as BOOK.chapter.verse (JHN.1.6 to JHN.1.8).",
          "pattern": "^[1-3A-Z][A-Z0-9]{2}\\.[0-9]+\\.[0-9]+$"
        },
        "end": {
          "type": "string",
          "description": "The verses it comments on, as BOOK.chapter.verse (JHN.1.6 to JHN.1.8).",
          "pattern": "^[1-3A-Z][A-Z0-9]{2}\\.[0-9]+\\.[0-9]+$"
        },
        "heading": {
          "type": "string",
          "description": "The source's own heading or lemma over the passage, where it has one."
        },
        "text": {
          "type": "string",
          "description": "The excerpt, copied from the source with scan corrections applied. Paragraphs are separated by a blank line, and a cut inside one is marked \" ... \"."
        },
        "locus": {
          "type": "string",
          "description": "Its place in a work with its own divisions: 2.8 is Homily 2, section 8."
        },
        "source_url": {
          "type": "string",
          "description": "The page or scan it was copied from."
        }
      }
    }
  }
}
