{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/run402-com/json-schema/run402-com-buzz-project-event-route-schema.json",
  "title": "BuzzProjectEventRoute",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/run402-com-buzz-control-plane-api-openapi.yml#/components/schemas/BuzzProjectEventRoute",
  "type": "object",
  "required": [
    "buzz_project_event_route_id",
    "org_id",
    "buzz_community_installation_id",
    "route_name",
    "buzz_channel_id",
    "project_ids",
    "event_types",
    "event_classes",
    "status",
    "pause_reason",
    "paused_at",
    "revision",
    "start_after_event_id",
    "consecutive_hard_failures",
    "notification_principal_id",
    "notification_pubkey",
    "signing_generation",
    "bot_mode",
    "created_at",
    "updated_at",
    "revoked_at"
  ],
  "properties": {
    "buzz_project_event_route_id": {
      "type": "string",
      "pattern": "^buzzper_[0-9a-f]{32}$"
    },
    "org_id": {
      "$ref": "#/$defs/BuzzOrgId"
    },
    "buzz_community_installation_id": {
      "type": "string",
      "pattern": "^buzzci_[0-9a-f]{32}$"
    },
    "route_name": {
      "type": "string"
    },
    "buzz_channel_id": {
      "type": "string"
    },
    "project_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "event_types": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "null routes every registered routable type (never an implicit [])."
    },
    "event_classes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "include_org_events": {
      "type": "boolean"
    },
    "on_call_buzz_pubkey": {
      "type": [
        "string",
        "null"
      ],
      "description": "The Buzz agent a crash or platform incident on this route pages (64-hex pubkey), or null."
    },
    "on_call_display_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The name the page addresses that agent by (`@<name> please investigate:`), or null for a tag-only page."
    },
    "project_scope": {
      "type": "string",
      "enum": [
        "listed",
        "org"
      ],
      "description": "listed: only project_ids are routed. org: every project the organization owns, present and future."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending_authorization",
        "active",
        "paused",
        "revoked"
      ]
    },
    "pause_reason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "owner",
        "delivery_failures",
        null
      ]
    },
    "paused_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "revision": {
      "type": "integer"
    },
    "start_after_event_id": {
      "type": "integer",
      "description": "The project-events outbox floor captured at creation: the consumer never delivers an event that predates the route (start_from: now)."
    },
    "consecutive_hard_failures": {
      "type": "integer",
      "description": "Consecutive hard relay-publish failures; crossing the bound auto-pauses the route with pause_reason delivery_failures."
    },
    "notification_principal_id": {
      "type": "string"
    },
    "notification_pubkey": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "signing_generation": {
      "type": "integer"
    },
    "bot_mode": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "attested",
        "installation_identity",
        null
      ],
      "description": "The installation's probed bot mode; attested means each project posts as its own bot."
    },
    "bots": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BuzzProjectBot"
      },
      "description": "On the single-route read: the route's live project bots (attested mode). Never a secret."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "revoked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "BuzzOrgId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "A Run402 organization id, exactly as returned by GET /agent/v1/whoami, GET /orgs/v1 and GET /projects/v1. Buzz owns no organizations of its own."
    },
    "BuzzProjectBot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "buzz_project_bot_id",
        "project_id",
        "pubkey",
        "display_name",
        "attested_by_generation",
        "profile_state",
        "status"
      ],
      "description": "A project's own Nostr identity in the community, attested by the installation identity with a NIP-OA auth tag. Never a relay member; never a secret.",
      "properties": {
        "buzz_project_bot_id": {
          "type": "string",
          "pattern": "^buzzbot_[0-9a-f]{32}$"
        },
        "project_id": {
          "type": "string"
        },
        "pubkey": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "display_name": {
          "type": "string"
        },
        "attested_by_generation": {
          "type": "integer"
        },
        "profile_state": {
          "type": "string",
          "enum": [
            "pending",
            "published"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "retired"
          ]
        }
      }
    }
  }
}