{
  "asyncapi": "3.0.0",
  "info": {
    "title": "data-sets",
    "version": ""
  },
  "channels": {
    "systemEventsDataAssetData": {
      "address": "system-events.data-asset.data",
      "messages": {
        "dataSetDataLoadFinished": {
          "$ref": "#/components/messages/data-asset.dataSetDataLoadFinished"
        }
      }
    }
  },
  "operations": {
    "dataSetDataLoadFinished": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsDataAssetData"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsDataAssetData/messages/dataSetDataLoadFinished"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "data-asset.dataSetDataLoadFinished": {
        "name": "com.qlik.v1.data-set.data.load.finished",
        "title": "Data set load finished",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "$ref": "#/components/schemas/datasetLoadFinishedObject"
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.v1.data-set.data.load.finished",
                  "description": "Data set load operation finished."
                }
              }
            }
          ]
        },
        "description": "Published when a data set load operation finishes, whether it succeeded or failed.",
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public",
        "x-qlik-deprecated": false
      }
    },
    "schemas": {
      "cloudEventsContextAttributes": {
        "type": "object",
        "required": [
          "id",
          "source",
          "specversion",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "A234-1234-1234"
            ],
            "minLength": 1,
            "description": "Identifies the event."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "minLength": 1,
            "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "description": "Describes the type of event related to the originating occurrence."
          },
          "source": {
            "type": "string",
            "format": "uri-reference",
            "examples": [
              "com.qlik/my-service"
            ],
            "minLength": 1,
            "description": "Identifies the context in which an event happened."
          },
          "specversion": {
            "type": "string",
            "examples": [
              "1.0"
            ],
            "minLength": 1,
            "description": "The version of the CloudEvents specification which the event uses."
          },
          "datacontenttype": {
            "type": "string",
            "default": "application/json",
            "minLength": 1,
            "description": "Content type of the data value. Must adhere to RFC 2046 format."
          }
        },
        "description": "CloudEvents Specification JSON Schema"
      },
      "cloudEventsQlikExtensionsAttributes": {
        "type": "object",
        "required": [
          "tenantid"
        ],
        "properties": {
          "userid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "Unique identifier for the user related to the event."
          },
          "updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/updateItem"
            },
            "example": [
              {}
            ],
            "description": "Updates of qemServer object"
          },
          "authtype": {
            "type": "string",
            "description": "Representing the type of principal that triggered the occurrence."
          },
          "tenantid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "Unique identifier for the tenant related to the event."
          },
          "authclaims": {
            "type": "string",
            "description": "A JSON string representing claims of the principal that triggered the event"
          },
          "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."
          },
          "toplevelresourceid": {
            "type": "string",
            "examples": [
              "id123"
            ],
            "description": "Unique identifier referring to integration application related to the event."
          }
        }
      },
      "dataLoadConsumptionObject": {
        "type": "object",
        "properties": {
          "totalBytes": {
            "type": "number",
            "example": 20000,
            "description": "Harmonized total bytes property, same value as totalBytesLoaded."
          },
          "totalBytesLoaded": {
            "type": "number",
            "example": 20000,
            "description": "Total bytes loaded in a specific load operation."
          }
        }
      },
      "datasetLoadFinishedObject": {
        "type": "object",
        "properties": {
          "appId": {
            "type": "string",
            "format": "uid",
            "example": "id123",
            "description": "Unique identifier for the app related to the event."
          },
          "dataSetId": {
            "type": "string",
            "example": "id123",
            "description": "Unique identifier for the data set related to the event."
          },
          "firstLoad": {
            "type": "boolean",
            "example": true,
            "description": "Indicates whether the load reported is the first time the data set is loaded (can be used by backend systems to aggregate/bill differently based on first time indication)."
          },
          "consumption": {
            "$ref": "#/components/schemas/dataLoadConsumptionObject"
          },
          "dataAssetId": {
            "type": "string",
            "example": "id123",
            "description": "Unique identifier for the data asset related to the event."
          },
          "loadEndedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the data set load ended. Must adhere to RFC 3339."
          },
          "loadSuccess": {
            "type": "boolean",
            "example": true,
            "description": "Indicates whether the load was successful (can be used by backend systems to aggregate/bill differently based on success criteria)."
          },
          "errorMessage": {
            "type": "string",
            "example": "Failed to connect to source",
            "description": "Error message describing why the load failed (only populated when loadSuccess is false)"
          },
          "dataAssetType": {
            "type": "string",
            "example": "LANDING",
            "description": "Type of the data asset the load belongs to (e.g. LANDING, STORAGE)."
          },
          "loadStartedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the data set load started. Must adhere to RFC 3339."
          },
          "notChargeable": {
            "type": "boolean",
            "example": false,
            "description": "When this field is set to true the event should be discarded from consumption metrics."
          },
          "recordsLoaded": {
            "type": "integer",
            "example": 20,
            "description": "Number of records loaded into the data set (only applicable on finished event)."
          },
          "dataSetSecureQRI": {
            "type": "string",
            "example": "qri:db:snowflake://Bh__CEOO2-D2Ty2f5egzjobOWnrxe6Cl8hHjJ6G08KE#w7OWgEHpy-iUi4EVNEGGQ6bJwU3FT6RdX38hbbrpJlM",
            "description": "Secure QRI (Qlik resource identifier) of the data set related to the event. It identifies the data set's underlying resource without exposing connection details."
          },
          "notChargeableReason": {
            "type": "string",
            "example": "Transform to QCS",
            "description": "Description for why the event is set to notChargeable."
          }
        }
      },
      "updateItem": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "updated item path"
          },
          "newvalue": {
            "type": "string",
            "description": "new value at given path"
          },
          "oldvalue": {
            "type": "string",
            "description": "original value at given path"
          }
        }
      }
    }
  }
}