{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jesuswords.me/data/schema.json",
  "title": "Jesus' Words passage resource",
  "description": "Schema for one standalone passage JSON resource or the citable bulk passages.json resource.",
  "$ref": "#/$defs/PassageResource",
  "$defs": {
    "Segment": {
      "type": "object",
      "description": "A text fragment or structural break within one verse.",
      "properties": {
        "v": {
          "type": "integer",
          "description": "Verse number."
        },
        "text": {
          "type": "string"
        },
        "wj": {
          "type": "boolean",
          "description": "True when the source USFM marks this segment as Jesus' direct speech."
        },
        "break": {
          "type": "string",
          "description": "USFM-derived paragraph or poetry break before the next text segment."
        }
      },
      "required": [
        "v"
      ],
      "additionalProperties": false
    },
    "License": {
      "type": "object",
      "properties": {
        "code": {
          "const": "CC-BY-NC-4.0"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "attribution": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "name",
        "url",
        "attribution"
      ],
      "additionalProperties": false
    },
    "TopicLink": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "slug",
        "title",
        "url"
      ],
      "additionalProperties": false
    },
    "TopicRecord": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "passages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "slug",
        "title",
        "passages",
        "canonical_url"
      ],
      "additionalProperties": false
    },
    "ParallelLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "reference": {
          "type": "string"
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        },
        "data_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "id",
        "reference",
        "canonical_url",
        "data_url"
      ],
      "additionalProperties": false
    },
    "ThomasSaying": {
      "type": "object",
      "description": "A mapped saying from the public-domain Mattison translation of the Gospel of Thomas.",
      "properties": {
        "id": {
          "type": "string"
        },
        "source": {
          "const": "Thomas"
        },
        "pericope": {
          "type": "string"
        },
        "chapter": {
          "type": [
            "integer",
            "null"
          ]
        },
        "verse_start": {
          "type": "integer"
        },
        "verse_end": {
          "type": "integer"
        },
        "text_web": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Segment"
          }
        },
        "text_kjv": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Segment"
          }
        },
        "context_tag": {
          "type": [
            "string",
            "null"
          ]
        },
        "context_tags": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "parallel_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "thomas_parallel": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "scroll_order": {
          "type": [
            "integer",
            "null"
          ]
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "source",
        "verse_start",
        "verse_end",
        "text_web"
      ],
      "additionalProperties": false
    },
    "PassageResource": {
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "format": "uri"
        },
        "schema_version": {
          "type": "string"
        },
        "license": {
          "$ref": "#/$defs/License"
        },
        "id": {
          "type": "string",
          "description": "Stable passage identifier derived from the source Gospel and starting verse."
        },
        "reference": {
          "type": "string",
          "description": "Human-readable biblical reference."
        },
        "source": {
          "type": "string",
          "enum": [
            "Matthew",
            "Mark",
            "Luke",
            "John"
          ]
        },
        "pericope": {
          "type": "string",
          "description": "Editorial passage title."
        },
        "chapter": {
          "type": "integer"
        },
        "verse_start": {
          "type": "integer"
        },
        "verse_end": {
          "type": "integer"
        },
        "aland_number": {
          "type": "integer",
          "description": "Section number in Aland's Synopsis of the Four Gospels."
        },
        "context_tag": {
          "type": [
            "string",
            "null"
          ],
          "description": "Legacy single context tag; use context_tags."
        },
        "context_tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "epoch": {
          "type": "integer",
          "description": "Broad narrative-period ordering marker."
        },
        "notes": {
          "type": "string"
        },
        "parallel_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Stable IDs of aligned canonical Gospel passages and mapped Thomas sayings."
        },
        "scroll_order": {
          "type": [
            "integer",
            "null"
          ]
        },
        "text_web": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Segment"
          }
        },
        "text_kjv": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Segment"
          }
        },
        "thomas_parallel": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "Numbers of mapped sayings in the Gospel of Thomas."
        },
        "psalm_parallel": {
          "type": "integer",
          "description": "Psalm number quoted in the passage; currently used for Psalm 22 at the crucifixion."
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        },
        "data_url": {
          "type": "string",
          "format": "uri"
        },
        "topics": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TopicLink"
          }
        },
        "parallel_passages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ParallelLink"
          }
        },
        "thomas_sayings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ThomasSaying"
          }
        }
      },
      "required": [
        "$schema",
        "schema_version",
        "license",
        "id",
        "reference",
        "source",
        "pericope",
        "chapter",
        "verse_start",
        "verse_end",
        "text_web",
        "text_kjv",
        "parallel_ids",
        "thomas_parallel",
        "canonical_url",
        "data_url",
        "topics",
        "parallel_passages",
        "thomas_sayings"
      ],
      "additionalProperties": false
    },
    "ParallelGroup": {
      "type": "object",
      "properties": {
        "aland_num": {
          "type": "integer"
        },
        "title": {
          "type": "string"
        },
        "passages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "thomas_parallel": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        }
      },
      "required": [
        "aland_num",
        "title",
        "passages",
        "thomas_parallel"
      ],
      "additionalProperties": false
    },
    "BulkDataset": {
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "format": "uri-reference"
        },
        "schema_version": {
          "type": "string"
        },
        "dataset_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "license": {
          "$ref": "#/$defs/License"
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        },
        "manifest_url": {
          "type": "string",
          "format": "uri"
        },
        "passages": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/PassageResource"
          }
        },
        "topics": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TopicRecord"
          }
        },
        "orderings": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "parallel_groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ParallelGroup"
          }
        },
        "toc": {
          "type": "object",
          "additionalProperties": true
        }
      },
      "required": [
        "$schema",
        "schema_version",
        "dataset_version",
        "generated_at",
        "license",
        "canonical_url",
        "manifest_url",
        "passages",
        "topics",
        "orderings",
        "parallel_groups",
        "toc"
      ],
      "additionalProperties": false
    }
  }
}
