{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getzero.dev/contracts/zero.replay_entrypoints.v1.schema.json",
  "title": "ZERO Public Replay Entrypoints",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "kind",
    "status",
    "generated_at",
    "canonical_url",
    "public",
    "current_blocker",
    "score_gate",
    "privacy_boundary",
    "coverage",
    "surfaces",
    "graph",
    "blockers"
  ],
  "properties": {
    "schema_version": { "const": "zero.replay_entrypoints.v1" },
    "kind": { "const": "public_replay_entrypoints" },
    "status": { "enum": ["entrypoints_ready", "entrypoints_degraded"] },
    "generated_at": { "type": "string", "format": "date-time" },
    "canonical_url": { "const": "https://getzero.dev/api/replays/entrypoints" },
    "public": { "const": true },
    "current_blocker": { "enum": ["public_replay_entrypoints_missing", null] },
    "score_gate": {
      "type": "object",
      "additionalProperties": false,
      "required": ["can_promote_public_score", "reason", "next_blocker"],
      "properties": {
        "can_promote_public_score": { "type": "boolean" },
        "reason": { "type": "string", "minLength": 1 },
        "next_blocker": { "const": "recurring_public_decision_artifacts_missing" }
      }
    },
    "privacy_boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "public_only",
        "private_trace_payloads_public",
        "private_keys_public",
        "operator_ids_public",
        "delayed_profile_replays"
      ],
      "properties": {
        "public_only": { "const": true },
        "private_trace_payloads_public": { "const": false },
        "private_keys_public": { "const": false },
        "operator_ids_public": { "const": false },
        "delayed_profile_replays": { "const": true }
      }
    },
    "coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "surface_count",
        "graph_link_count",
        "replay_count",
        "detail_entrypoints",
        "has_home_entrypoint",
        "has_operator_profile_entrypoint",
        "has_agent_profile_entrypoint",
        "has_replay_index",
        "has_replay_detail",
        "has_export_capsule",
        "has_share_image_template"
      ],
      "properties": {
        "surface_count": { "type": "integer", "minimum": 0 },
        "graph_link_count": { "type": "integer", "minimum": 0 },
        "replay_count": { "type": "integer", "minimum": 0 },
        "detail_entrypoints": { "type": "integer", "minimum": 0 },
        "has_home_entrypoint": { "type": "boolean" },
        "has_operator_profile_entrypoint": { "type": "boolean" },
        "has_agent_profile_entrypoint": { "type": "boolean" },
        "has_replay_index": { "type": "boolean" },
        "has_replay_detail": { "type": "boolean" },
        "has_export_capsule": { "type": "boolean" },
        "has_share_image_template": { "type": "boolean" }
      }
    },
    "surfaces": {
      "type": "array",
      "minItems": 7,
      "items": { "$ref": "#/$defs/surface" }
    },
    "graph": {
      "type": "array",
      "minItems": 6,
      "items": { "$ref": "#/$defs/graph_link" }
    },
    "blockers": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    }
  },
  "$defs": {
    "surface": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "surface",
        "label",
        "page_url",
        "json_url",
        "status",
        "supported_filters",
        "sample_replay_ids"
      ],
      "properties": {
        "surface": {
          "enum": [
            "homepage",
            "operator_profile",
            "agent_profile",
            "replay_index",
            "replay_detail",
            "export_capsule",
            "share_image"
          ]
        },
        "label": { "type": "string", "minLength": 1 },
        "page_url": { "type": "string", "format": "uri" },
        "json_url": { "type": "string", "format": "uri" },
        "status": { "enum": ["ready", "degraded"] },
        "supported_filters": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "sample_replay_ids": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        }
      }
    },
    "graph_link": {
      "type": "object",
      "additionalProperties": false,
      "required": ["from_surface", "to_surface", "relation", "href"],
      "properties": {
        "from_surface": { "$ref": "#/$defs/surface_id" },
        "to_surface": { "$ref": "#/$defs/surface_id" },
        "relation": { "type": "string", "minLength": 1 },
        "href": { "type": "string", "format": "uri" }
      }
    },
    "surface_id": {
      "enum": [
        "homepage",
        "operator_profile",
        "agent_profile",
        "replay_index",
        "replay_detail",
        "export_capsule",
        "share_image"
      ]
    }
  }
}
