{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tiffany.systems/api/schema/claim-view.schema.json",
  "title": "ClaimView",
  "description": "One immutable claim version with everything a machine client needs to decide what it may and may not conclude: the record itself, its identity and digest, the evidence coverage map, the deterministic policy decisions, and the semantic diff against the previous version.",
  "x-schema-version": "1.0.0",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "classification", "identity", "citation", "record", "coverage", "policy", "semantic_diff"],
  "properties": {
    "schema": {"const": "tiffany.systems/schema/claim-view/1.0.0"},
    "classification": {"type": "string"},
    "demo": {"type": "boolean"},
    "notice": {"type": "string"},
    "identity": {
      "type": "object", "additionalProperties": false, "required": ["id", "version", "digest", "version_url", "current_url"],
      "properties": {
        "id": {"type": "string"},
        "version": {"type": "string", "pattern": "^v[0-9]+$"},
        "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$", "description": "Over the canonical serialization of `record` with its digest field removed. Recomputable by any client."},
        "version_url": {"type": "string"},
        "current_url": {"type": "string"},
        "bundle_url": {"type": "string"}
      }
    },
    "citation": {
      "type": "object", "additionalProperties": false, "required": ["version_url", "digest", "plain", "bibtex"],
      "properties": {
        "version_url": {"type": "string"}, "current_url": {"type": "string"}, "digest": {"type": "string"},
        "plain": {"type": "string"}, "bibtex": {"type": "string"}
      }
    },
    "record": {"type": "object", "description": "A Claim record. Validated separately against claim.schema.json."},
    "coverage": {
      "type": "object", "additionalProperties": false, "required": ["sentence", "counts", "rows"],
      "properties": {
        "sentence": {"type": "string", "description": "Prose, never a percentage. A client must not derive a score from it."},
        "counts": {"type": "object"},
        "rows": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id", "support"],
          "properties": {"id": {"type": "string"}, "support": {"type": "string"}, "evidence": {"type": "array", "items": {"type": "string"}}}}}
      }
    },
    "policy": {
      "type": "object", "additionalProperties": false, "required": ["publishable", "rules"],
      "properties": {
        "publishable": {"type": "boolean"},
        "rules": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id", "title", "requirement", "status", "blocks_publication"],
          "properties": {"id": {"type": "string"}, "title": {"type": "string"}, "requirement": {"type": "string"},
            "status": {"type": "string", "enum": ["PASS", "FAIL", "NOT_APPLICABLE"]},
            "satisfied": {"type": "array", "items": {"type": "string"}},
            "missing": {"type": "array", "items": {"type": "string"}},
            "blocks_publication": {"type": "boolean"}}}}
      }
    },
    "semantic_diff": {"type": "array", "items": {"type": "object"}}
  }
}
