{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tiffany.systems/api/schema/bundle.schema.json",
  "title": "ResearchBundle",
  "description": "A self-describing, portable scientific record. Designed to stay intelligible and checkable if tiffany.systems, its database and its search index all disappear.",
  "x-schema-version": "1.0.0",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "identity", "canonicalization", "citation", "status_at_bundle_time", "record", "manifest", "limits"],
  "properties": {
    "schema": {"const": "tiffany.systems/schema/bundle/1.0.0"},
    "notice": {"type": "string"},
    "purpose": {"type": "string"},
    "identity": {"type": "object", "required": ["id", "version", "digest", "canonical_url"],
      "properties": {"id": {"type": "string"}, "version": {"type": "string"}, "digest": {"type": "string"},
        "canonical_url": {"type": "string"}, "current_url": {"type": "string"}}},
    "canonicalization": {"type": "string", "description": "Stated in full so the digest can be re-derived without this site's code."},
    "citation": {"type": "object"},
    "status_at_bundle_time": {"type": "object", "required": ["lifecycle", "qualification"],
      "properties": {"lifecycle": {"type": "string"}, "qualification": {"type": "string"},
        "superseded_by": {"type": ["string", "null"]}, "withdrawal": {"type": ["object", "null"]}},
      "description": "The state when this bundle was generated. A client holding an old bundle must re-fetch the version URL to learn what happened since."},
    "ontology_version": {"type": "string"},
    "record": {"type": "object"},
    "manifest": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["path", "sha256", "bytes", "media_type", "license"],
      "properties": {"path": {"type": "string"}, "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "bytes": {"type": "integer"}, "media_type": {"type": "string"}, "license": {"type": "string"}, "url": {"type": "string"}}}},
    "verification": {"type": "object"},
    "limits": {"type": "string"}
  }
}
