{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "nt-observation-input.v0.schema.json",
  "title": "Neverthought consequence observation input v0",
  "description": "An observed consequence of a recorded crossing, as a visitor supplies it. The workspace keeps these exact bytes, attempts to map the observation onto a path declared by the crossing's frozen class, and never adds a path to the class. Independence of the source is declared by the observer; the workspace does not verify it.",
  "type": "object",
  "additionalProperties": false,
  "required": ["observation_version", "observation_id", "crossing_receipt_ref", "class_id", "class_version", "observed_at", "source_ref",
    "description", "independence_basis", "value_status", "amount", "attempted_path", "supersedes"],
  "properties": {
    "observation_version": { "const": "nt-observation-input:v0" },
    "observation_id": { "type": "string", "pattern": "^[A-Za-z0-9._-]{1,64}$" },
    "crossing_receipt_ref": { "description": "receipt_ref of the determination this consequence is attributed to.", "type": "string", "minLength": 1 },
    "class_id": { "type": "string", "minLength": 1 },
    "class_version": { "description": "Must be the version the crossing was determined under.", "type": "string", "minLength": 1 },
    "observed_at": { "description": "Valid time: when the consequence occurred or was observed. Not after the record time.", "type": "string", "minLength": 1 },
    "source_ref": { "description": "Where the observation comes from. A reference, not the evidence itself.", "type": "string", "minLength": 1 },
    "description": { "type": "string", "minLength": 1 },
    "independence_basis": {
      "description": "Why the source is independent of the party that relied on the crossing, or null. Declared, not verified.",
      "type": ["string", "null"], "minLength": 1
    },
    "value_status": { "description": "known: the amount or outcome is reported; pending: not yet known; disputed: contested.", "enum": ["known", "pending", "disputed"] },
    "amount": {
      "oneOf": [
        { "type": "null" },
        { "type": "object", "additionalProperties": false, "required": ["minor", "currency"],
          "properties": { "minor": { "type": "integer", "minimum": 0 }, "currency": { "type": "string", "pattern": "^[A-Z]{3}$" } } }
      ]
    },
    "attempted_path": { "description": "The declared consequence path the observer believes this followed, or null when they found none.", "type": ["string", "null"], "minLength": 1 },
    "supersedes": {
      "oneOf": [
        { "type": "null" },
        { "type": "object", "additionalProperties": false, "required": ["observation_id", "kind", "reason"],
          "properties": {
            "observation_id": { "type": "string", "minLength": 1 },
            "kind": { "description": "supersession: later information replaces earlier (e.g. a reported amount replacing pending). correction: the earlier record was wrong.", "enum": ["supersession", "correction"] },
            "reason": { "type": "string", "minLength": 1 } } }
      ]
    }
  }
}
