{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jonashertner.com/content/schema.json",
  "title": "Jonas Hertner public content catalogue",
  "description": "Version 1.0. Published primary documents with complete text derived from their canonical Markdown editions. Translation entries identify other available editions, excluding the document itself. Dates describe content revision, not catalogue generation.",
  "type": "object",
  "additionalProperties": false,
  "required": ["$schema", "schema_version", "url", "updated", "documents"],
  "properties": {
    "$schema": { "const": "https://jonashertner.com/content/schema.json" },
    "schema_version": { "const": "1.0" },
    "url": { "const": "https://jonashertner.com/content/index.json" },
    "updated": { "$ref": "#/$defs/date", "description": "The latest modified date among the included documents." },
    "documents": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/document" } }
  },
  "$defs": {
    "date": { "type": "string", "format": "date", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
    "language": { "enum": ["en-CH", "de-CH", "fr-CH", "en"] },
    "canonicalUrl": { "type": "string", "format": "uri", "pattern": "^https://jonashertner\\.com/(?:[a-z0-9-]+/)*$" },
    "translation": {
      "type": "object", "additionalProperties": false, "required": ["language", "url"],
      "properties": {
        "language": { "$ref": "#/$defs/language" },
        "url": { "$ref": "#/$defs/canonicalUrl" }
      }
    },
    "section": {
      "type": "object", "additionalProperties": false, "required": ["id", "title", "url"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1 },
        "url": { "type": "string", "format": "uri", "pattern": "^https://jonashertner\\.com/[^?#]*#[^#]+$" }
      }
    },
    "document": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "kind", "language", "title", "description", "url", "markdown_url", "modified", "translations", "markdown_sha256", "text", "sections"],
      "properties": {
        "id": { "type": "string", "format": "uri", "pattern": "^https://jonashertner\\.com/[^?#]*#(?:webpage|post|article)$", "description": "The stable content_id from the canonical Markdown front matter." },
        "kind": { "enum": ["home", "note", "framework", "essay"] },
        "language": { "$ref": "#/$defs/language" },
        "title": { "type": "string", "minLength": 1 },
        "description": { "type": "string", "minLength": 1 },
        "author": { "type": "string", "minLength": 1, "description": "Author as declared in the canonical Markdown front matter, where present." },
        "citation": { "type": "string", "minLength": 1, "description": "Suggested citation from the canonical Markdown front matter, where present." },
        "url": { "$ref": "#/$defs/canonicalUrl" },
        "markdown_url": { "type": "string", "format": "uri", "pattern": "^https://jonashertner\\.com/(?:[a-z0-9-]+/)*index\\.md$" },
        "published": { "$ref": "#/$defs/date" },
        "modified": { "$ref": "#/$defs/date" },
        "translations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/translation" } },
        "markdown_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$", "description": "SHA-256 of the exact UTF-8 Markdown file, including front matter and final newline." },
        "text": { "type": "string", "minLength": 1, "description": "Complete Markdown body rendered as plain text, including footnotes and absolute link destinations. Empty HTML anchors, front matter and presentation syntax are omitted." },
        "sections": { "type": "array", "items": { "$ref": "#/$defs/section" }, "description": "Headings with explicit Markdown anchors verified against the canonical HTML. Anonymous headings are not assigned invented fragments." }
      }
    }
  }
}
