{
  "openapi": "3.1.0",
  "info": {
    "title": "BDI Connector API",
    "version": "0.1.0",
    "description": "Generated OpenAPI specification for con. See the BDI reference implementation for wire-format details."
  },
  "servers": [
    {
      "url": "http://localhost:8080",
      "description": "local-dev"
    }
  ],
  "tags": [
    {
      "name": "bdi",
      "description": "BDI core operations"
    }
  ],
  "paths": {
    "/proxy/check": {
      "post": {
        "operationId": "proxyCheck",
        "summary": "Verify BVAD + BVOD + local policy for a prospective request",
        "tags": [
          "bdi",
          "proxy"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string"
                  },
                  "resource": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Permit"
          }
        }
      }
    },
    "/webhooks/inbound": {
      "post": {
        "operationId": "inboundWebhook",
        "summary": "Accept a signed webhook from an allowed issuer",
        "tags": [
          "bdi",
          "webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted"
          }
        }
      }
    },
    "/webhooks/outbound": {
      "post": {
        "operationId": "outboundWebhook",
        "summary": "Enqueue an outbound webhook delivery",
        "tags": [
          "bdi",
          "webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "target_url",
                  "event_id",
                  "event_type"
                ],
                "properties": {
                  "target_url": {
                    "type": "string"
                  },
                  "event_id": {
                    "type": "string"
                  },
                  "event_type": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued"
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "operationId": "metrics",
        "summary": "Prometheus exposition",
        "tags": [
          "ops"
        ],
        "responses": {
          "200": {
            "description": "Prometheus text"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Euid": {
        "type": "string",
        "pattern": "^[A-Z]{2}\\.[A-Z]+\\.[A-Z0-9-]+$",
        "description": "EUID — country.register.localId"
      },
      "AssociationId": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_-]{1,31}$"
      },
      "ConnectorId": {
        "type": "string",
        "pattern": "^urn:bdi:connector:[0-9a-f-]{36}$"
      },
      "ChainContextId": {
        "type": "string",
        "pattern": "^[0-9a-f-]{36}$"
      },
      "Assurance": {
        "type": "string",
        "enum": [
          "substantial",
          "high"
        ]
      },
      "MemberStatus": {
        "type": "string",
        "enum": [
          "draft",
          "verified",
          "activated",
          "suspended",
          "revoked"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  }
}
