{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://jkolantree.github.io/astra/schemas/document-semantic-identity-v1.schema.json",
  "title": "SPPT/ASTRA document semantic identity v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "build_epoch", "records"],
  "properties": {
    "schema": {"const": "https://jkolantree.github.io/astra/schemas/document-semantic-identity-v1.schema.json"},
    "build_epoch": {"type": "string", "format": "date-time"},
    "records": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["author", "html", "html_sha256", "language", "pdf", "pdf_accessibility", "pdf_normalized_text_sha256", "pdf_pages", "pdf_sha256", "source", "source_sha256", "title", "version"],
        "properties": {
          "author": {"type": "string", "minLength": 1},
          "html": {"type": "string", "pattern": "\\.html$"},
          "html_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "language": {"const": "en-US"},
          "pdf": {"type": "string", "pattern": "\\.pdf$"},
          "pdf_accessibility": {"type": "string", "minLength": 1},
          "pdf_normalized_text_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "pdf_pages": {"type": "integer", "minimum": 1},
          "pdf_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "source": {"enum": ["manuscript.md", "supplement.md"]},
          "source_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "title": {"type": "string", "minLength": 1},
          "version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"}
        }
      }
    }
  }
}
