{
  "asyncapi": "3.0.0",
  "info": {
    "title": "app-usages",
    "version": ""
  },
  "channels": {
    "systemEventsAppUsage": {
      "address": "system-events.app-usage",
      "messages": {
        "appUsageQuotaConsumed": {
          "$ref": "#/components/messages/app-usage.appUsageQuotaConsumed"
        }
      }
    }
  },
  "operations": {
    "appUsageQuotaConsumed": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsAppUsage"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsAppUsage/messages/appUsageQuotaConsumed"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "app-usage.appUsageQuotaConsumed": {
        "name": "com.qlik.v1.app-usage.quota.consumed",
        "tags": [
          {
            "name": "app-usage"
          }
        ],
        "title": "App usage quota consumed",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "$ref": "#/components/schemas/appQuotaUsage"
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.v1.app-usage.quota.consumed",
                  "description": "Unique identifier for the event type."
                }
              }
            }
          ]
        },
        "description": "Published when application quota usage is recorded for a tenant. The event provides a snapshot of total quota consumption and per-space usage breakdowns, enabling subscribers to track storage allocation, enforce capacity policies, and optimize resource distribution across spaces.\n",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      }
    },
    "schemas": {
      "appQuotaUsage": {
        "type": "object",
        "examples": [
          {
            "unit": "byte",
            "quota": "appSizeTotalDefault",
            "usage": 2048
          }
        ],
        "required": [
          "quota",
          "usage",
          "unit"
        ],
        "properties": {
          "unit": {
            "enum": [
              "byte"
            ],
            "type": "string",
            "description": "The unit of measurement for quota usage (currently `byte`)."
          },
          "quota": {
            "enum": [
              "appSizeTotalDefault"
            ],
            "type": "string",
            "description": "The name of the quota being reported."
          },
          "usage": {
            "type": "integer",
            "examples": [
              1024
            ],
            "description": "The total quota usage in the specified `unit`."
          },
          "spaceUsages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/spaceUsage"
            },
            "description": "The quota usage breakdown per space within the tenant."
          }
        },
        "description": "Represents a snapshot of the total application quota usage for a tenant."
      },
      "cloudEventsContextAttributes": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "Unique identifier for the event."
          },
          "host": {
            "type": "string",
            "examples": [
              "qlik.example.com"
            ],
            "description": "The host that generated the event."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2018-10-30T07:06:22Z"
            ],
            "description": "Timestamp of when the event occurred, in ISO 8601 format."
          },
          "type": {
            "type": "string",
            "examples": [
              "com.qlik.v1.app.created"
            ],
            "minLength": 1,
            "description": "Describes the type of event related to the originating occurrence."
          },
          "source": {
            "type": "string",
            "default": "com.qlik/qix-sessions",
            "description": "The source of the event."
          },
          "ownerid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The owner ID of the event."
          },
          "originip": {
            "type": "string",
            "examples": [
              "192.168.1.1"
            ],
            "description": "The origin IP address of the event source."
          },
          "specversion": {
            "enum": [
              "1.0"
            ],
            "type": "string",
            "examples": [
              "1.0"
            ],
            "description": "The event is compatible with the CloudEvents specification v1.0."
          },
          "datacontenttype": {
            "type": "string",
            "default": "application/json",
            "description": "The content type of the event payload."
          }
        },
        "description": "CloudEvents Specification JSON Schema"
      },
      "cloudEventsQlikExtensionsAttributes": {
        "type": "object",
        "required": [
          "tenantid"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "examples": [
              "some reason"
            ],
            "description": "The reason why the event was triggered."
          },
          "userid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the user related to the event."
          },
          "spaceid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the space related to the event."
          },
          "authtype": {
            "type": "string",
            "examples": [
              "qix-sessions"
            ],
            "description": "Representing the type of principal that triggered the occurrence."
          },
          "clientid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the client related to the event."
          },
          "tenantid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the tenant related to the event."
          },
          "sessionid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the session related to the event."
          },
          "authclaims": {
            "type": "string",
            "examples": [
              "{\"iss\": \"qlik.api.internal/qix-sessions\", \"sub\": \"qix-sessions\", \"subType\": \"service\"}"
            ],
            "description": "A JSON string representing claims of the principal that triggered the event."
          },
          "tracestate": {
            "type": "string",
            "examples": [
              "b3=f0cc846cd24db3f68e384e9ccdfbf225-226ac0c507065555-1"
            ],
            "description": "A comma-delimited list of key-value pairs for distributed tracing state."
          },
          "traceparent": {
            "type": "string",
            "examples": [
              "00-f0cc846cd24db3f68e384e9ccdfbf225-226ac0c507065555-01"
            ],
            "description": "Contains a version, trace ID, span ID, and trace options in W3C Trace Context format."
          },
          "toplevelresourceid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "The unique identifier for the top-level resource related to the event."
          }
        },
        "description": "Additional metadata and custom fields"
      },
      "spaceUsage": {
        "type": "object",
        "properties": {
          "unit": {
            "enum": [
              "byte"
            ],
            "type": "string",
            "description": "The unit of measurement for the space quota usage (currently `byte`)."
          },
          "usage": {
            "type": "integer",
            "examples": [
              1024
            ],
            "description": "The quota usage for this space in the specified `unit`."
          },
          "spaceId": {
            "type": "string",
            "examples": [
              "660534c0b90cd088f5555555"
            ],
            "description": "The unique identifier for the space."
          }
        },
        "description": "Represents a quota usage snapshot for a single space."
      }
    }
  }
}