{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.osoix.com/ecb-1.schema.json",
  "title": "OSOIX Epistemic Circuit Breaker v1 Evaluation",
  "description": "Fail-closed claim-promotion policy evaluation built on an RBP-1 capsule.",
  "type": "object",
  "required": [
    "protocol",
    "profile",
    "evaluatedAt",
    "context",
    "circuitState",
    "capsuleDigest",
    "subject",
    "summary",
    "hardStops",
    "claims",
    "promotionLadder",
    "nextEvidence",
    "boundaries",
    "digest"
  ],
  "properties": {
    "protocol": { "const": "osoix.ecb.v1" },
    "profile": { "const": "osoix.ecb.orbital-claim-promotion.v1" },
    "evaluatedAt": { "type": "string", "format": "date-time" },
    "context": { "$ref": "#/$defs/context" },
    "circuitState": { "$ref": "#/$defs/circuitState" },
    "capsuleDigest": { "$ref": "#/$defs/digest" },
    "subject": {
      "type": "object",
      "required": ["type", "noradId", "name"],
      "properties": {
        "type": { "const": "orbital-object" },
        "noradId": { "type": "string", "pattern": "^[0-9]{1,8}$" },
        "name": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "summary": {
      "type": "object",
      "required": ["totalClaims", "allowedClaims", "guardedClaims", "deniedClaims", "notApplicableClaims", "evidenceSources"],
      "properties": {
        "totalClaims": { "type": "integer", "minimum": 0 },
        "allowedClaims": { "type": "integer", "minimum": 0 },
        "guardedClaims": { "type": "integer", "minimum": 0 },
        "deniedClaims": { "type": "integer", "minimum": 0 },
        "notApplicableClaims": { "type": "integer", "minimum": 0 },
        "evidenceSources": { "type": "integer", "minimum": 0 }
      },
      "additionalProperties": false
    },
    "hardStops": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
    "claims": { "type": "array", "items": { "$ref": "#/$defs/claimDecision" } },
    "promotionLadder": { "type": "array", "minItems": 5, "maxItems": 5, "items": { "$ref": "#/$defs/promotionStep" } },
    "nextEvidence": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
    "boundaries": {
      "type": "object",
      "required": ["policyOnly", "truthProbabilityCalculated", "reliabilityProbabilityCalculated", "safetyApprovalGranted", "commandAuthorityGranted", "commandPath"],
      "properties": {
        "policyOnly": { "const": true },
        "truthProbabilityCalculated": { "const": false },
        "reliabilityProbabilityCalculated": { "const": false },
        "safetyApprovalGranted": { "const": false },
        "commandAuthorityGranted": { "const": false },
        "commandPath": { "const": false }
      },
      "additionalProperties": false
    },
    "digest": { "$ref": "#/$defs/digest" }
  },
  "$defs": {
    "context": { "enum": ["presentation", "research", "advisory", "safety-critical", "command"] },
    "circuitState": { "enum": ["CLOSED", "GUARDED", "OPEN"] },
    "decision": { "enum": ["ALLOW", "ALLOW_WITH_DISCLOSURE", "DENY", "NOT_APPLICABLE"] },
    "realityClass": { "enum": ["OBSERVED", "REPORTED", "CALCULATED", "PROJECTED", "INFERRED", "SYNTHETIC", "UNKNOWN"] },
    "digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "nullableNumber": { "type": ["number", "null"], "minimum": 0 },
    "claimDecision": {
      "type": "object",
      "required": ["claimId", "label", "realityClass", "decision", "reasons", "disclosures", "missingEvidence", "sourceAgeHours", "horizonHours", "claimDigest"],
      "properties": {
        "claimId": { "type": "string", "minLength": 1 },
        "label": { "type": "string", "minLength": 1 },
        "realityClass": { "$ref": "#/$defs/realityClass" },
        "decision": { "$ref": "#/$defs/decision" },
        "reasons": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
        "disclosures": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
        "missingEvidence": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
        "sourceAgeHours": { "$ref": "#/$defs/nullableNumber" },
        "horizonHours": { "type": "number", "minimum": 0, "maximum": 72 },
        "claimDigest": { "$ref": "#/$defs/digest" }
      },
      "additionalProperties": false
    },
    "promotionStep": {
      "type": "object",
      "required": ["context", "state", "allowedClaims", "guardedClaims", "deniedClaims", "statement"],
      "properties": {
        "context": { "$ref": "#/$defs/context" },
        "state": { "$ref": "#/$defs/circuitState" },
        "allowedClaims": { "type": "integer", "minimum": 0 },
        "guardedClaims": { "type": "integer", "minimum": 0 },
        "deniedClaims": { "type": "integer", "minimum": 0 },
        "statement": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
