{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "nt-eri-vector.v0.schema.json",
  "title": "Neverthought ERI v0 vector",
  "description": "Research programme, proposed. A versioned vector of evidential and structural conditions for one crossing, projected from its determination, appraisal and consequence observations. Every component is categorical. No component is weighted, ordered against another or aggregated, and no scalar is defined. It is not a score, rating, premium, underwriting recommendation, coverage determination, causal finding or certification.",
  "$defs": {
    "ids": { "type": "array", "items": { "type": "string" } },
    "reason": { "enum": ["INVALID", "INPUT_BINDING_FAILED", "UNAUTHORIZED", "EXPIRED", "POLICY_DENIED", "INVARIANT_FAILED", "UNRESOLVED", "UNAVAILABLE", "REPLAY_FAILED"] },
    "register": { "type": "object", "additionalProperties": false, "required": ["status", "reasons"], "properties": { "status": { "type": "string" }, "reasons": { "type": "array", "items": { "type": "string" } } } }
  },
  "type": "object",
  "additionalProperties": false,
  "required": ["eri_version", "crossing", "as_of", "gate", "value", "structure", "evidence_authority", "history", "observations"],
  "properties": {
    "eri_version": { "const": "nt-eri:v0" },
    "crossing": {
      "type": "object", "additionalProperties": false, "required": ["proposal_id", "receipt_ref", "class_ref", "valid_time", "record_time"],
      "properties": { "proposal_id": { "type": "string" }, "receipt_ref": { "type": "string" }, "class_ref": { "type": "string" }, "valid_time": { "type": "string" }, "record_time": { "type": "string" } }
    },
    "as_of": { "type": ["string", "null"] },
    "gate": {
      "type": "object", "additionalProperties": false, "required": ["outcome", "reason_codes"],
      "properties": { "outcome": { "enum": ["EXECUTE", "HOLD"] }, "reason_codes": { "type": "array", "items": { "$ref": "#/$defs/reason" } } }
    },
    "value": { "allOf": [{ "$ref": "#/$defs/register" }, { "properties": { "status": { "enum": ["known", "pending", "disputed"] } } }] },
    "structure": { "allOf": [{ "$ref": "#/$defs/register" }, { "properties": { "status": { "enum": ["untested", "challenged", "supported"] } } }] },
    "evidence_authority": {
      "type": "object", "additionalProperties": false, "required": ["status", "blockers", "independence"],
      "properties": {
        "status": { "enum": ["satisfied", "incomplete", "blocked"] },
        "blockers": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["check", "status", "reason"],
          "properties": { "check": { "type": "string" }, "status": { "enum": ["FAIL", "UNAVAILABLE", "UNMEASURABLE"] }, "reason": { "oneOf": [{ "$ref": "#/$defs/reason" }, { "type": "null" }] } } } },
        "independence": { "description": "As declared in the proposal; not verified.", "enum": ["declared_independent", "self_asserted", "not_required"] }
      }
    },
    "history": {
      "type": "object", "additionalProperties": false, "required": ["replay", "standing", "standing_causes", "execution"],
      "properties": {
        "replay": { "description": "Self-replay from the same inputs; not independent replay.", "enum": ["reproduces", "differs"] },
        "standing": { "enum": ["PRESERVED", "STRENGTHENED", "WEAKENED", "DEFEATED", "NEW", "UNRESOLVED"] },
        "standing_causes": { "type": "array", "items": { "enum": ["VALID_TIME_MOVED", "EVIDENCE_ARRIVED_LATE", "AVAILABILITY_DIFFERED", "GRAMMAR_CHANGED", "PROPOSAL_REVISED"] } },
        "execution": { "enum": ["not_executed", "executed_with_warrant", "executed_without_warrant"] }
      }
    },
    "observations": {
      "type": "object", "additionalProperties": false, "required": ["matched", "unmatched_declared_independent", "unmatched_unresolved", "superseded"],
      "properties": {
        "matched": { "$ref": "#/$defs/ids" },
        "unmatched_declared_independent": { "$ref": "#/$defs/ids" },
        "unmatched_unresolved": { "$ref": "#/$defs/ids" },
        "superseded": { "$ref": "#/$defs/ids" }
      }
    }
  }
}
