{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Webhook/v1/schema.json",
  "title": "Webhook",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "readOnly": true,
      "description": "Always 'webhooks-config'; one configuration per Organization Account."
    },
    "orgAcctID": {
      "type": "string",
      "readOnly": true,
      "description": "Derived from the access token."
    },
    "webhooksEndpointConfig": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WebhookEndpointConfig"
      }
    },
    "objectMeta": {
      "readOnly": true,
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ObjectMeta/v1/schema.json"
    }
  },
  "required": [
    "webhooksEndpointConfig"
  ],
  "$defs": {
    "WebhookEndpointConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "events": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/WebhookEvent"
          }
        },
        "enabled": {
          "type": "boolean"
        }
      },
      "required": [
        "endpoint",
        "events",
        "enabled"
      ]
    },
    "WebhookEvent": {
      "description": "The event type for which the webhook is configured.",
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/WebhooksEventsEnumeration/v1/schema.json"
    }
  }
}