{
  "asyncapi": "3.0.0",
  "info": {
    "title": "core/licenses",
    "version": ""
  },
  "channels": {
    "systemEventsLicenses": {
      "address": "system-events.licenses",
      "messages": {
        "coreLicenseConsumptionReported": {
          "$ref": "#/components/messages/licenses.coreLicenseConsumptionReported"
        }
      }
    }
  },
  "operations": {
    "coreLicenseConsumptionReported": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsLicenses"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsLicenses/messages/coreLicenseConsumptionReported"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "licenses.coreLicenseConsumptionReported": {
        "name": "com.qlik.core.license.consumption.reported",
        "title": "Consumption reported",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikCommonAttributes"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "default": "com.qlik.core.license.consumption.reported",
                  "description": "The event type identifier."
                }
              }
            },
            {
              "$ref": "#/components/schemas/consumptionReported"
            }
          ]
        },
        "description": "Event triggered when usage is reported for a license.",
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public",
        "x-qlik-deprecated": false
      }
    },
    "schemas": {
      "cloudEventsAttributes": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the event."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the event is emitted."
          },
          "type": {
            "type": "string",
            "description": "Type of the event."
          },
          "source": {
            "type": "string",
            "description": "The source of the event. Always set to the fixed value `qlik.com/licenses` by the publisher."
          },
          "specversion": {
            "enum": [
              "1.0"
            ],
            "type": "string",
            "description": "CloudEvents spec version."
          },
          "datacontenttype": {
            "type": "string",
            "default": "application/json",
            "description": "The content type of the event payload."
          }
        }
      },
      "cloudEventsQlikCommonAttributes": {
        "type": "object",
        "properties": {
          "authtype": {
            "type": "string",
            "description": "The type of principal that triggered the event."
          },
          "authclaims": {
            "type": "string",
            "description": "JSON string representing claims of the principal."
          },
          "tracestate": {
            "type": "string",
            "description": "A comma-delimited list of key-value pairs."
          },
          "traceparent": {
            "type": "string",
            "description": "Contains a version, trace ID, span ID, and trace options."
          }
        }
      },
      "consumptionReported": {
        "type": "object",
        "required": [
          "tenantid",
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "featureId",
              "currentUsage",
              "currentChange",
              "usageLimit",
              "usageUsedPercentage",
              "hasUnlimitedUsage",
              "isSoftLimit"
            ],
            "properties": {
              "unit": {
                "type": "string",
                "description": "The usage unit."
              },
              "featureId": {
                "type": "string",
                "description": "The feature identifier."
              },
              "periodEnd": {
                "type": "string",
                "format": "date-time",
                "description": "End of the current usage period, if specified."
              },
              "periodType": {
                "enum": [
                  "day",
                  "week",
                  "month",
                  "year"
                ],
                "type": "string",
                "description": "The reset period type (e.g. month)."
              },
              "usageLimit": {
                "type": "number",
                "description": "The total amount of the feature resource available for the current period."
              },
              "featureName": {
                "type": "string",
                "description": "The feature display name."
              },
              "isSoftLimit": {
                "type": "boolean",
                "description": "Whether the limit is a soft limit. Soft limits are not enforced."
              },
              "periodStart": {
                "type": "string",
                "format": "date-time",
                "description": "Start of the current usage period, if specified."
              },
              "currentUsage": {
                "type": "number",
                "description": "Current consumption of the feature resource."
              },
              "currentChange": {
                "type": "number",
                "description": "Change in usage since last measurement."
              },
              "hasUnlimitedUsage": {
                "type": "boolean",
                "description": "Whether there is unlimited availability of the feature resource for the current period. If true, usageLimit is null and usageUsedPercentage is 0."
              },
              "usageUsedPercentage": {
                "type": "number",
                "description": "Percentage of the feature resource consumed. Relative to usageLimit, can go above 100."
              }
            }
          },
          "tenantid": {
            "type": "string",
            "description": "Unique identifier of the tenant related to the event."
          }
        }
      }
    }
  }
}