{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/run402-com/json-schema/run402-com-ci-binding-row-schema.json",
  "title": "CiBindingRow",
  "description": "A row from internal.ci_bindings — one per CI binding. Persistent forensic record; revoked rows are kept for audit.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/run402-com-ci-federation-api-openapi.yml#/components/schemas/CiBindingRow",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^bnd_",
      "description": "Binding id, prefixed `bnd_`."
    },
    "project_id": {
      "type": "string"
    },
    "issuer": {
      "type": "string",
      "description": "OIDC issuer URL (FK to internal.trusted_oidc_issuers). v1 only: https://token.actions.githubusercontent.com."
    },
    "subject_match": {
      "type": "string",
      "maxLength": 256
    },
    "allowed_actions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "deploy"
        ]
      }
    },
    "allowed_events": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Sorted-deduped on insert. Default `['push','workflow_dispatch']`."
    },
    "route_scopes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Sorted-deduped explicit route patterns CI may alter. Empty array means CI cannot ship non-null `spec.routes`."
    },
    "asset_key_scopes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "maxLength": 256
      },
      "description": "Per-binding allowlist for the `spec.assets` slice. NULL means no asset authority (default for bindings created via `POST /ci/v1/bindings`). Each entry is an exact asset key or `prefix/*` wildcard. Mutated via `POST /ci/v1/bindings/{binding_id}/asset-scopes`."
    },
    "github_repository_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_by": {
      "type": "string",
      "description": "Lowercase EVM wallet address."
    },
    "nonce": {
      "type": "string",
      "pattern": "^[0-9a-f]{16,64}$"
    },
    "created_sig": {
      "type": "object",
      "description": "Parsed delegation: { payload, raw, signer, verified_at }. Stored verbatim for forensic re-verification.",
      "additionalProperties": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "revoked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "use_count": {
      "type": "integer",
      "format": "int64"
    }
  }
}