{
  "$ref": "#/definitions/Schema",
  "$schema": "http://json-schema.org/draft-06/schema#",
  "definitions": {
    "ApiKey": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/definitions/ID"
        },
        "name": {
          "type": "string"
        },
        "scopes": {
          "items": {
            "$ref": "#/definitions/Scope"
          },
          "type": "array"
        },
        "secret": {
          "type": "string"
        },
        "user": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "scopes",
        "secret",
        "user"
      ],
      "type": "object"
    },
    "CreateApiKeyRequest": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "scopes": {
          "items": {
            "$ref": "#/definitions/Scope"
          },
          "type": "array"
        }
      },
      "required": [
        "name",
        "scopes"
      ],
      "type": "object"
    },
    "CreateLogSubscriptionRequest": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "filters": {
          "$ref": "#/definitions/LogSubscriptionFilters"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "enum": [
            "log"
          ],
          "type": "string"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "description",
        "filters",
        "name",
        "type",
        "webhookUrl"
      ],
      "type": "object"
    },
    "CreateSubscriptionRequest": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "filters": {
          "anyOf": [
            {
              "$ref": "#/definitions/LogSubscriptionFilters"
            },
            {
              "$ref": "#/definitions/TransactionSubscriptionFilters"
            }
          ]
        },
        "name": {
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/SubscriptionType"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "description",
        "filters",
        "name",
        "type",
        "webhookUrl"
      ],
      "type": "object"
    },
    "CreateTransactionSubscriptionRequest": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "filters": {
          "$ref": "#/definitions/TransactionSubscriptionFilters"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "enum": [
            "transaction"
          ],
          "type": "string"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "description",
        "filters",
        "name",
        "type",
        "webhookUrl"
      ],
      "type": "object"
    },
    "FilterOptionValue": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ]
    },
    "GetExampleLogRequest": {
      "additionalProperties": false,
      "properties": {
        "filters": {
          "$ref": "#/definitions/LogSubscriptionFilters"
        },
        "type": {
          "enum": [
            "log"
          ],
          "type": "string"
        }
      },
      "required": [
        "filters",
        "type"
      ],
      "type": "object"
    },
    "GetExampleRequest": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "$ref": "#/definitions/SubscriptionType"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "GetExampleTransactionRequest": {
      "additionalProperties": false,
      "properties": {
        "filters": {
          "$ref": "#/definitions/TransactionSubscriptionFilters"
        },
        "type": {
          "enum": [
            "transaction"
          ],
          "type": "string"
        }
      },
      "required": [
        "filters",
        "type"
      ],
      "type": "object"
    },
    "ID": {
      "format": "uuid",
      "type": "string"
    },
    "LogFilterType": {
      "enum": [
        "address",
        "topic0",
        "topic1",
        "topic2",
        "topic3"
      ],
      "type": "string"
    },
    "LogSubscription": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "filters": {
          "$ref": "#/definitions/LogSubscriptionFilters"
        },
        "id": {
          "$ref": "#/definitions/ID"
        },
        "name": {
          "type": "string"
        },
        "secret": {
          "type": "string"
        },
        "status": {
          "$ref": "#/definitions/SubscriptionStatus"
        },
        "subscriptionArn": {
          "type": "string"
        },
        "timestamp": {
          "type": "number"
        },
        "type": {
          "enum": [
            "log"
          ],
          "type": "string"
        },
        "user": {
          "type": "string"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "filters",
        "id",
        "name",
        "secret",
        "status",
        "subscriptionArn",
        "timestamp",
        "type",
        "user",
        "webhookUrl"
      ],
      "type": "object"
    },
    "LogSubscriptionFilters": {
      "additionalProperties": false,
      "properties": {
        "address": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "topic0": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "topic1": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "topic2": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "topic3": {
          "$ref": "#/definitions/FilterOptionValue"
        }
      },
      "type": "object"
    },
    "Schema": {
      "anyOf": [
        {
          "$ref": "#/definitions/SubscriptionStatus"
        },
        {
          "$ref": "#/definitions/SubscriptionType"
        },
        {
          "$ref": "#/definitions/LogFilterType"
        },
        {
          "$ref": "#/definitions/TransactionFilterType"
        },
        {
          "$ref": "#/definitions/FilterOptionValue"
        },
        {
          "$ref": "#/definitions/LogSubscriptionFilters"
        },
        {
          "$ref": "#/definitions/TransactionSubscriptionFilters"
        },
        {
          "$ref": "#/definitions/Subscription"
        },
        {
          "$ref": "#/definitions/LogSubscription"
        },
        {
          "$ref": "#/definitions/TransactionSubscription"
        },
        {
          "$ref": "#/definitions/CreateSubscriptionRequest"
        },
        {
          "$ref": "#/definitions/CreateTransactionSubscriptionRequest"
        },
        {
          "$ref": "#/definitions/CreateLogSubscriptionRequest"
        },
        {
          "$ref": "#/definitions/WebhookReceiptResult"
        },
        {
          "$ref": "#/definitions/WebhookReceipt"
        },
        {
          "$ref": "#/definitions/CreateApiKeyRequest"
        },
        {
          "$ref": "#/definitions/ApiKey"
        },
        {
          "$ref": "#/definitions/Scope"
        },
        {
          "$ref": "#/definitions/GetExampleRequest"
        },
        {
          "$ref": "#/definitions/GetExampleTransactionRequest"
        },
        {
          "$ref": "#/definitions/GetExampleLogRequest"
        }
      ]
    },
    "Scope": {
      "enum": [
        "read:subscription",
        "create:subscription",
        "deactivate:subscription",
        "read:apiKey",
        "create:apiKey",
        "deactivate:apiKey"
      ],
      "type": "string"
    },
    "Subscription": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "id": {
          "$ref": "#/definitions/ID"
        },
        "name": {
          "type": "string"
        },
        "secret": {
          "type": "string"
        },
        "status": {
          "$ref": "#/definitions/SubscriptionStatus"
        },
        "subscriptionArn": {
          "type": "string"
        },
        "timestamp": {
          "type": "number"
        },
        "type": {
          "$ref": "#/definitions/SubscriptionType"
        },
        "user": {
          "type": "string"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "timestamp",
        "secret",
        "user",
        "name",
        "webhookUrl",
        "status",
        "subscriptionArn"
      ],
      "type": "object"
    },
    "SubscriptionStatus": {
      "enum": [
        "active",
        "deactivated"
      ],
      "type": "string"
    },
    "SubscriptionType": {
      "enum": [
        "log",
        "transaction"
      ],
      "type": "string"
    },
    "TransactionFilterType": {
      "enum": [
        "from",
        "to",
        "methodSignature"
      ],
      "type": "string"
    },
    "TransactionSubscription": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "filters": {
          "$ref": "#/definitions/TransactionSubscriptionFilters"
        },
        "id": {
          "$ref": "#/definitions/ID"
        },
        "name": {
          "type": "string"
        },
        "secret": {
          "type": "string"
        },
        "status": {
          "$ref": "#/definitions/SubscriptionStatus"
        },
        "subscriptionArn": {
          "type": "string"
        },
        "timestamp": {
          "type": "number"
        },
        "type": {
          "enum": [
            "transaction"
          ],
          "type": "string"
        },
        "user": {
          "type": "string"
        },
        "webhookUrl": {
          "type": "string"
        }
      },
      "required": [
        "filters",
        "id",
        "name",
        "secret",
        "status",
        "subscriptionArn",
        "timestamp",
        "type",
        "user",
        "webhookUrl"
      ],
      "type": "object"
    },
    "TransactionSubscriptionFilters": {
      "additionalProperties": false,
      "properties": {
        "from": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "methodSignature": {
          "$ref": "#/definitions/FilterOptionValue"
        },
        "to": {
          "$ref": "#/definitions/FilterOptionValue"
        }
      },
      "type": "object"
    },
    "WebhookReceipt": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/definitions/ID"
        },
        "result": {
          "$ref": "#/definitions/WebhookReceiptResult"
        },
        "subscriptionId": {
          "$ref": "#/definitions/ID"
        },
        "timestamp": {
          "type": "number"
        },
        "ttl": {
          "type": "number"
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "subscriptionId",
        "ttl",
        "url",
        "timestamp",
        "result"
      ],
      "type": "object"
    },
    "WebhookReceiptResult": {
      "additionalProperties": false,
      "properties": {
        "error": {
          "type": "string"
        },
        "statusCode": {
          "type": "number"
        },
        "success": {
          "type": "boolean"
        }
      },
      "required": [
        "statusCode",
        "success"
      ],
      "type": "object"
    }
  }
}