{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getzero.dev/contracts/zero.public_decision_artifacts.v1.schema.json",
  "title": "ZERO Public Recurring Decision Artifacts",
  "type": "object",
  "required": [
    "schema_version",
    "kind",
    "status",
    "generated_at",
    "canonical_url",
    "public",
    "artifact_horizon",
    "coverage",
    "shelves",
    "links",
    "privacy_boundary",
    "score_gate",
    "blockers"
  ],
  "properties": {
    "schema_version": {
      "const": "zero.public_decision_artifacts.v1"
    },
    "kind": {
      "const": "public_recurring_decision_artifacts"
    },
    "status": {
      "enum": [
        "decision_artifacts_ready",
        "decision_artifacts_degraded"
      ]
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "canonical_url": {
      "const": "https://getzero.dev/api/replays/decision-artifacts"
    },
    "public": {
      "const": true
    },
    "attestation_basis": {
      "type": "object",
      "description": "Freshness of the STORED replay lane (where refusal frames write) \u2014 the only valid basis for an event-driven quiet attestation in the cadence monitor. Additive in-place: optional so prior validators keep passing.",
      "additionalProperties": false,
      "required": [
        "stored_newest_at",
        "stored_summary_count"
      ],
      "properties": {
        "stored_newest_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "stored_summary_count": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "artifact_horizon": {
      "type": "object",
      "required": [
        "scanned_replays",
        "retained_artifacts",
        "min_required_artifacts",
        "min_required_shelves"
      ],
      "properties": {
        "scanned_replays": {
          "type": "integer",
          "minimum": 0
        },
        "retained_artifacts": {
          "type": "integer",
          "minimum": 0
        },
        "min_required_artifacts": {
          "type": "integer",
          "minimum": 1
        },
        "min_required_shelves": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "coverage": {
      "type": "object",
      "required": [
        "replay_count",
        "shelf_count",
        "ready_shelf_count",
        "receipt_card_count",
        "graph_context_count",
        "outcome_family_count",
        "refusal_shelf_ready",
        "followthrough_shelf_ready",
        "same_policy_shelf_ready",
        "public_surface_count"
      ],
      "properties": {
        "replay_count": {
          "type": "integer",
          "minimum": 0
        },
        "shelf_count": {
          "type": "integer",
          "minimum": 0
        },
        "ready_shelf_count": {
          "type": "integer",
          "minimum": 0
        },
        "receipt_card_count": {
          "type": "integer",
          "minimum": 0
        },
        "graph_context_count": {
          "type": "integer",
          "minimum": 0
        },
        "outcome_family_count": {
          "type": "integer",
          "minimum": 0
        },
        "refusal_shelf_ready": {
          "type": "boolean"
        },
        "followthrough_shelf_ready": {
          "type": "boolean"
        },
        "same_policy_shelf_ready": {
          "type": "boolean"
        },
        "public_surface_count": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "shelves": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "shelf_id",
          "label",
          "family_type",
          "status",
          "artifact_count",
          "cadence",
          "replay_ids",
          "receipt_card_urls",
          "graph_context_urls",
          "replay_index_url",
          "public_surface_urls",
          "summary"
        ],
        "properties": {
          "shelf_id": {
            "type": "string",
            "minLength": 1
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "family_type": {
            "enum": [
              "refusal_cluster",
              "followthrough",
              "same_policy",
              "recent_decisions"
            ]
          },
          "status": {
            "enum": [
              "ready",
              "degraded"
            ]
          },
          "artifact_count": {
            "type": "integer",
            "minimum": 0
          },
          "cadence": {
            "type": "object",
            "required": [
              "period",
              "newest_at",
              "oldest_at",
              "recurring"
            ],
            "properties": {
              "period": {
                "const": "rolling_public_window"
              },
              "newest_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "oldest_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "recurring": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "replay_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "receipt_card_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "graph_context_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "replay_index_url": {
            "type": "string",
            "format": "uri"
          },
          "public_surface_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "summary": {
            "type": "string",
            "minLength": 1
          }
        },
        "additionalProperties": false
      }
    },
    "links": {
      "type": "object",
      "required": [
        "replay_index",
        "entrypoints",
        "decision_graph",
        "receipt_card_example",
        "export",
        "schema"
      ],
      "properties": {
        "replay_index": {
          "type": "string",
          "format": "uri"
        },
        "entrypoints": {
          "type": "string",
          "format": "uri"
        },
        "decision_graph": {
          "type": "string",
          "format": "uri"
        },
        "receipt_card_example": {
          "type": "string",
          "format": "uri"
        },
        "export": {
          "type": "string",
          "format": "uri"
        },
        "schema": {
          "const": "https://getzero.dev/contracts/zero.public_decision_artifacts.v1.schema.json"
        }
      },
      "additionalProperties": false
    },
    "privacy_boundary": {
      "type": "object",
      "required": [
        "public_only",
        "private_trace_payloads_public",
        "private_keys_public",
        "operator_ids_public",
        "prompt_bodies_public",
        "tool_payloads_public",
        "performance_metrics_public"
      ],
      "properties": {
        "public_only": {
          "const": true
        },
        "private_trace_payloads_public": {
          "const": false
        },
        "private_keys_public": {
          "const": false
        },
        "operator_ids_public": {
          "const": false
        },
        "prompt_bodies_public": {
          "const": false
        },
        "tool_payloads_public": {
          "const": false
        },
        "performance_metrics_public": {
          "const": false
        }
      },
      "additionalProperties": false
    },
    "score_gate": {
      "type": "object",
      "required": [
        "can_promote_public_score",
        "reason",
        "previous_blocker",
        "next_blocker"
      ],
      "properties": {
        "can_promote_public_score": {
          "type": "boolean"
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "previous_blocker": {
          "const": "recurring_public_decision_artifacts_missing"
        },
        "next_blocker": {
          "const": "public_decision_artifact_cadence_missing"
        }
      },
      "additionalProperties": false
    },
    "blockers": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    }
  },
  "additionalProperties": false
}
