{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tiffany.systems/api/schema/claim.schema.json",
  "title": "Claim",
  "description": "One immutable version of one scientific claim. The claim, not the paper, is the unit of publication.",
  "x-schema-version": "1.0.0",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema","kind","id","version","classification","title","statement","plain_language","lifecycle","qualification","epistemic","scope","components","evidence","methods","limitations","falsifiers","provenance","release","last_material_change"],
  "properties": {
    "schema": {"const": "tiffany.systems/schema/claim/1.0.0"},
    "kind": {"const": "Claim"},
    "id": {"type": "string", "pattern": "^claim/[a-z0-9]([a-z0-9-]*[a-z0-9])?$", "description": "Stable identity. Never derived from the title; a retitled claim keeps this id."},
    "version": {"type": "string", "pattern": "^v[0-9]+$"},
    "classification": {"type": "string", "enum": ["PUBLIC","PUBLIC_SANITIZED","DEMO_FIXTURE","EMBARGOED","INTERNAL","PROTECTED","SECURITY_SENSITIVE","LICENSE_RESTRICTED","PRIVATE_INFRASTRUCTURE"]},
    "demo": {"type": "boolean"},
    "issued": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"},
    "title": {"type": "string", "minLength": 3},
    "statement": {"type": "string", "minLength": 3, "description": "The canonical claim. Authoritative wording."},
    "plain_language": {"type": "string", "minLength": 3, "description": "May omit detail. May never strengthen or contradict the statement."},
    "lifecycle": {"type": "string", "enum": ["CURRENT","SUPERSEDED","WITHDRAWN","FALSIFIED","HISTORICAL"]},
    "qualification": {"type": "string", "enum": ["FROZEN_ADOPTED","QUALIFIED","QUALIFIED_AT_CURRENT_SCOPE","EXPERIMENTAL","FRONTIER_BOUNDED","UNOBSERVED","NOT_PRODUCTION_QUALIFIED"]},
    "epistemic": {
      "type": "object", "additionalProperties": false,
      "required": ["evidence_level","causal_level","replication","measurement_validity","contamination","provenance_completeness"],
      "properties": {
        "evidence_level": {"type": "string", "enum": ["ASSERTED_ONLY","SINGLE_OBSERVATION","CONTROLLED_SINGLE","CONTROLLED_REPEATED","PREREGISTERED_CONTROLLED"]},
        "causal_level": {"type": "string", "enum": ["NONE_ASSERTED","ASSOCIATIONAL","INTERVENTIONAL","MECHANISTIC"]},
        "replication": {"type": "string", "enum": ["NONE","INTERNAL_REPRODUCTION","INDEPENDENT_REPLICATION_PARTIAL","INDEPENDENT_REPLICATION_FULL"]},
        "measurement_validity": {"type": "string", "enum": ["UNVALIDATED","CONSTRUCT_UNCERTAIN","VALIDATED_IN_SCOPE"]},
        "contamination": {"type": "string", "enum": ["UNASSESSED","SUSPECTED","KNOWN_PRESENT","ASSESSED_NONE_KNOWN"]},
        "provenance_completeness": {"type": "string", "enum": ["INCOMPLETE","PARTIAL","COMPLETE"]}
      }
    },
    "scope": {
      "type": "object", "additionalProperties": false, "required": ["tested","excluded","untested_regions","known_failure_regions"],
      "properties": {
        "tested": {"type": "array", "items": {"type": "string"}},
        "excluded": {"type": "array", "items": {"type": "string"}},
        "untested_regions": {"type": "array", "items": {"type": "string"}},
        "known_failure_regions": {"type": "array", "items": {"type": "string"}},
        "environment_assumptions": {"type": "array", "items": {"type": "string"}},
        "measurement_assumptions": {"type": "array", "items": {"type": "string"}}
      }
    },
    "assumptions": {
      "type": "array",
      "items": {"type": "object", "additionalProperties": false, "required": ["id","statement","status"],
        "properties": {
          "id": {"type": "string"},
          "statement": {"type": "string"},
          "kind": {"type": "string", "enum": ["DOMAIN","MEASUREMENT","ENVIRONMENT","RESOURCE","MODELLING"]},
          "status": {"type": "string", "enum": ["UNTESTED","TESTED_HOLDS","TESTED_FAILS","UNTESTABLE"]}
        }}
    },
    "components": {
      "type": "array", "minItems": 1,
      "description": "The claim decomposed into separately-supportable parts. A claim-level badge may never imply support the components do not have.",
      "items": {"type": "object", "additionalProperties": false, "required": ["id","text","support"],
        "properties": {
          "id": {"type": "string"},
          "text": {"type": "string"},
          "support": {"type": "string", "enum": ["DIRECT","INDIRECT","SCOPE_LIMITED","UNREPLICATED","CONTRADICTED","UNMEASURED","ASSUMPTION_DEPENDENT","UNSUPPORTED"]},
          "evidence_refs": {"type": "array", "items": {"type": "string"}},
          "assumption_refs": {"type": "array", "items": {"type": "string"}},
          "note": {"type": "string"}
        }}
    },
    "evidence": {
      "type": "array",
      "items": {"type": "object", "additionalProperties": false, "required": ["id","kind","title","classification","summary"],
        "properties": {
          "id": {"type": "string"},
          "kind": {"type": "string", "enum": ["EXPERIMENT","NEGATIVE_CONTROL","OBSERVATION","DATASET","ANALYSIS","ATTESTATION","EXTERNAL_LITERATURE"]},
          "title": {"type": "string"},
          "classification": {"type": "string", "enum": ["PUBLIC","PUBLIC_SANITIZED","DEMO_FIXTURE","EMBARGOED","INTERNAL","PROTECTED","SECURITY_SENSITIVE","LICENSE_RESTRICTED","PRIVATE_INFRASTRUCTURE"]},
          "summary": {"type": "string"},
          "artifact_refs": {"type": "array", "items": {"type": "string"}},
          "controls": {"type": "array", "items": {"type": "string"}},
          "direction": {"type": "string", "enum": ["SUPPORTS","CONTRADICTS","NEUTRAL"]},
          "license": {"type": "string"}
        }}
    },
    "methods": {"type": "string", "minLength": 3},
    "limitations": {"type": "array", "minItems": 1, "items": {"type": "string"}},
    "uncertainty": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "type": {"type": "string", "enum": ["NONE_QUANTIFIED","SAMPLING","MEASUREMENT","MODEL","SYSTEMATIC"]},
        "statement": {"type": "string"},
        "interval": {"type": "string"},
        "units": {"type": "string"}
      }
    },
    "falsifiers": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","statement","status"],
        "properties": {
          "id": {"type": "string"},
          "statement": {"type": "string", "description": "A concrete observation that, if made, refutes the claim."},
          "status": {"type": "string", "enum": ["REGISTERED_UNEXECUTED","EXECUTED_SURVIVED","EXECUTED_FAILED","UNEXECUTABLE"]},
          "executed": {"type": "string"},
          "result": {"type": "string"},
          "evidence_refs": {"type": "array", "items": {"type": "string"}}
        }}
    },
    "replications": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","kind","outcome","independence","equivalence_criterion"],
        "properties": {
          "id": {"type": "string"},
          "kind": {"type": "string", "enum": ["ARTIFACT_VERIFICATION","COMPUTATIONAL_REPLAY","EXPERIMENTAL_REPRODUCTION","INDEPENDENT_REPLICATION"]},
          "outcome": {"type": "string", "enum": ["MATCHED","PARTIALLY_MATCHED","DID_NOT_MATCH","INCONCLUSIVE"]},
          "components_covered": {"type": "array", "items": {"type": "string"}},
          "equivalence_criterion": {"type": "string", "enum": ["BYTE_EQUALITY","TOLERANCE","DISTRIBUTIONAL","INVARIANT_PRESERVATION","STATE_TRANSITION"]},
          "criterion_fixed_before_execution": {"type": "boolean"},
          "independence": {"type": "object", "additionalProperties": false,
            "required": ["people","implementation","data","apparatus","provider_model","environment","shared_dependencies"],
            "properties": {
              "people": {"type": "string", "enum": ["SAME","OVERLAPPING","INDEPENDENT"]},
              "implementation": {"type": "string", "enum": ["SAME","DERIVED","INDEPENDENT"]},
              "data": {"type": "string", "enum": ["SAME","OVERLAPPING","INDEPENDENT"]},
              "apparatus": {"type": "string", "enum": ["SAME","SIMILAR","INDEPENDENT"]},
              "provider_model": {"type": "string", "enum": ["SAME","SIMILAR","INDEPENDENT","NOT_APPLICABLE"]},
              "environment": {"type": "string", "enum": ["SAME","SIMILAR","INDEPENDENT"]},
              "shared_dependencies": {"type": "array", "items": {"type": "string"}},
              "protocol_deviations": {"type": "array", "items": {"type": "string"}}
            }},
          "evidence_refs": {"type": "array", "items": {"type": "string"}},
          "note": {"type": "string"}
        }}
    },
    "contradictions": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","statement","status"],
        "properties": {"id": {"type": "string"}, "statement": {"type": "string"}, "status": {"type": "string", "enum": ["OPEN","RESOLVED","RETIRED"]}, "evidence_refs": {"type": "array", "items": {"type": "string"}}, "resolution": {"type": "string"}}}
    },
    "evidence_debt": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","type","statement","status"],
        "properties": {
          "id": {"type": "string"},
          "type": {"type": "string", "enum": ["MISSING_REPLICATION","MISSING_OOD_CHALLENGE","MEASUREMENT_GAP","CONTAMINATION_UNRESOLVED","UNTESTED_BOUNDARY","INCOMPLETE_PROVENANCE","UNEXECUTED_FALSIFIER","DATA_UNAVAILABLE","UNRESOLVED_CONTRADICTION","RELEASE_RESTRICTED"]},
          "statement": {"type": "string"},
          "status": {"type": "string", "enum": ["OPEN","DISCHARGED","ACCEPTED_PERMANENT"]},
          "blocks": {"type": "array", "items": {"type": "string"}},
          "opened": {"type": "string"}
        }}
    },
    "challenges": {
      "type": "array",
      "description": "Machine-readable challenge contracts. External criticism becomes a runnable test, not a vote.",
      "items": {"type": "object", "additionalProperties": false, "required": ["id","target_version","question","attack_surface","falsification_criterion","equivalence_criterion","expected_evidence","status"],
        "properties": {
          "id": {"type": "string"},
          "target_version": {"type": "string", "pattern": "^v[0-9]+$"},
          "question": {"type": "string"},
          "attack_surface": {"type": "string", "enum": ["MEASUREMENT","SCOPE","CAUSAL_INFERENCE","DATA_PROVENANCE","CONTAMINATION","IMPLEMENTATION","STATISTICAL","REPRODUCIBILITY"]},
          "falsification_criterion": {"type": "string"},
          "required_apparatus": {"type": "array", "items": {"type": "string"}},
          "equivalence_criterion": {"type": "string", "enum": ["BYTE_EQUALITY","TOLERANCE","DISTRIBUTIONAL","INVARIANT_PRESERVATION","STATE_TRANSITION"]},
          "expected_evidence": {"type": "array", "items": {"type": "string"}},
          "constraints": {"type": "array", "items": {"type": "string"}},
          "status": {"type": "string", "enum": ["OPEN","ACCEPTED","IN_PROGRESS","ANSWERED","WITHDRAWN"]},
          "outcome": {"type": "string"}
        }}
    },
    "dependencies": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","kind","ref"],
        "properties": {"id": {"type": "string"}, "kind": {"type": "string", "enum": ["DATASET","MODULE","APPARATUS","CLAIM","EXTERNAL_SERVICE","ASSUMPTION"]}, "ref": {"type": "string"}, "note": {"type": "string"}, "pinned_digest": {"type": "string"}}}
    },
    "provenance": {
      "type": "object", "additionalProperties": false, "required": ["completeness","chain"],
      "properties": {
        "completeness": {"type": "string", "enum": ["INCOMPLETE","PARTIAL","COMPLETE"]},
        "chain": {"type": "array", "minItems": 1, "items": {"type": "object", "additionalProperties": false, "required": ["step","actor","actor_kind","time"],
          "properties": {
            "step": {"type": "string"},
            "actor": {"type": "string"},
            "actor_kind": {"type": "string", "enum": ["HUMAN","ORGANISATION","SOFTWARE_AGENT","TIFFANY"]},
            "time": {"type": "string"},
            "input_digest": {"type": "string"},
            "output_digest": {"type": "string"},
            "sanitised": {"type": "boolean", "description": "True when a private input was transformed into a public record. The private input is never disclosed."},
            "note": {"type": "string"}
          }}}
      }
    },
    "artifacts": {
      "type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id","path","media_type","bytes","sha256","license","classification"],
        "properties": {
          "id": {"type": "string"},
          "path": {"type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$", "description": "A flat file name in the published artifact directory. No path separators and no parent references: an artifact reference must not be able to name anything outside that directory."},
          "media_type": {"type": "string"},
          "bytes": {"type": "integer"},
          "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "license": {"type": "string"},
          "classification": {"type": "string", "enum": ["PUBLIC","PUBLIC_SANITIZED","DEMO_FIXTURE","EMBARGOED","INTERNAL","PROTECTED","SECURITY_SENSITIVE","LICENSE_RESTRICTED","PRIVATE_INFRASTRUCTURE"]},
          "description": {"type": "string"}
        }}
    },
    "verification": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "recipe": {"type": "array", "items": {"type": "string"}},
        "kind": {"type": "string", "enum": ["ARTIFACT_VERIFICATION","COMPUTATIONAL_REPLAY","EXPERIMENTAL_REPRODUCTION","INDEPENDENT_REPLICATION"]},
        "expected": {"type": "string"},
        "note": {"type": "string"}
      }
    },
    "supersedes": {"type": ["string","null"]},
    "superseded_by": {"type": ["string","null"]},
    "withdrawal": {
      "type": "object", "additionalProperties": false, "required": ["reason","authority","time"],
      "properties": {"reason": {"type": "string"}, "authority": {"type": "string"}, "time": {"type": "string"}, "propagation": {"type": "array", "items": {"type": "string"}}}
    },
    "change_note": {"type": "string"},
    "last_material_change": {"type": "string"},
    "release": {
      "type": "object", "additionalProperties": false, "required": ["state","authorised_by","authorised_at"],
      "properties": {
        "state": {"type": "string", "enum": ["DRAFT","SCIENTIFICALLY_APPROVED","SECURITY_REVIEW","LICENSE_IP_REVIEW","PUBLICATION_BUILD","PREVIEW","PUBLIC","SUPERSEDED","WITHDRAWN"]},
        "authorised_by": {"type": "string"},
        "authorised_at": {"type": "string"},
        "note": {"type": "string"}
      }
    }
  }
}
