{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blockdaemon/main/json-schema/blockdaemon-target-schema.json",
  "title": "Target",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blockdaemon-event-streaming-api-openapi.yml#/components/schemas/Target",
  "type": "object",
  "required": [
    "id",
    "name",
    "type",
    "status",
    "settings",
    "max_buffer_count",
    "current_buffer_count"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "x-go-type": "myuuid.UUID",
      "x-go-type-import": {
        "name": "myuuid",
        "path": "github.com/google/uuid"
      }
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "disconnected",
        "active",
        "connected",
        "failed"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "webhook",
        "websocket"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "settings": {
      "anyOf": [
        {
          "$ref": "#/$defs/WebhookSettings"
        },
        {
          "$ref": "#/$defs/WebsocketSettings"
        },
        {
          "$ref": "#/$defs/EmailSettings"
        }
      ]
    },
    "max_buffer_count": {
      "$ref": "#/$defs/MaxBufferCount"
    },
    "current_buffer_count": {
      "type": "integer"
    }
  },
  "$defs": {
    "EmailSettings": {
      "title": "Email Settings",
      "description": "Used to send notifications or alerts to a specified recipient via email.",
      "type": "object",
      "required": [
        "name",
        "email"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The display name of the recipient."
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "The recipient's email address."
        }
      }
    },
    "MaxBufferCount": {
      "type": "integer",
      "default": 10000,
      "minimum": 10,
      "maximum": 10000,
      "description": "Maximum number of events that can be buffered before delivery."
    },
    "WebhookSettings": {
      "title": "Webhook Settings",
      "description": "Configuration for webhook-based targets. Includes the HTTP method, destination URL, and a secret used for signing and validating webhook messages.",
      "type": "object",
      "required": [
        "method",
        "destination",
        "secret"
      ],
      "properties": {
        "destination": {
          "type": "string",
          "description": "The destination URL where webhook events will be sent."
        },
        "method": {
          "type": "string",
          "description": "HTTP method used to deliver webhook events.",
          "enum": [
            "POST",
            "GET"
          ]
        },
        "secret": {
          "type": "string",
          "minLength": 10,
          "description": "Secret key used to sign webhook payloads. Must be at least 10 characters long."
        }
      }
    },
    "WebsocketSettings": {
      "title": "WebSocket Settings",
      "description": "Configuration for WebSocket-based targets. Used to establish a connection and authenticate event delivery.",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "secret": {
          "type": "string",
          "minLength": 10,
          "description": "Secret used to authenticate the WebSocket connection. Must be at least 10 characters long."
        }
      }
    }
  }
}