{
  "asyncapi": "3.0.0",
  "info": {
    "title": "reports",
    "version": ""
  },
  "channels": {
    "systemEventsReport": {
      "address": "system-events.report",
      "messages": {
        "reportCollected": {
          "$ref": "#/components/messages/report.reportCollected"
        },
        "reportTriggered": {
          "$ref": "#/components/messages/report.reportTriggered"
        }
      }
    }
  },
  "operations": {
    "reportCollected": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsReport"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsReport/messages/reportCollected"
        }
      ]
    },
    "reportTriggered": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsReport"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsReport/messages/reportTriggered"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "report.reportCollected": {
        "name": "com.qlik.v1.report.collected",
        "tags": [
          {
            "name": "report"
          }
        ],
        "title": "reporting-service has collected a reports request",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "required": [
                "data",
                "type"
              ],
              "properties": {
                "data": {
                  "$ref": "#/components/schemas/dataPayload"
                },
                "type": {
                  "enum": [
                    "com.qlik.v1.report.collected"
                  ],
                  "type": "string",
                  "default": "com.qlik.v1.report.collected",
                  "description": "Unique identifier for the event type."
                }
              }
            }
          ]
        },
        "description": "Reporting service event on reports request accepted and queued for processing according to the load type.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      },
      "report.reportTriggered": {
        "name": "com.qlik.v1.report.triggered",
        "tags": [
          {
            "name": "report"
          }
        ],
        "title": "reporting-service has triggered a reports request",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "required": [
                "data",
                "type"
              ],
              "properties": {
                "data": {
                  "$ref": "#/components/schemas/dataPayload"
                },
                "type": {
                  "enum": [
                    "com.qlik.v1.report.triggered"
                  ],
                  "type": "string",
                  "default": "com.qlik.v1.report.triggered",
                  "description": "Unique identifier for the event type."
                }
              }
            }
          ]
        },
        "description": "Reporting service event on reports request triggered for cycle-based report generation.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      }
    },
    "schemas": {
      "act": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": "string",
            "example": "qlik.api.internal",
            "description": "the acting issuer of the request"
          },
          "subject": {
            "type": "string",
            "example": "0d5fff2b-8429-4184-b4e6-1bc08cd1c840",
            "description": "the acting subject of the request"
          },
          "subtype": {
            "type": "string",
            "example": "service",
            "description": "the acting subtype of the request"
          }
        },
        "description": "The information from act header"
      },
      "chartDurationStat": {
        "type": "object",
        "description": "Type duration Map",
        "additionalProperties": {
          "$ref": "#/components/schemas/durationStat"
        }
      },
      "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",
            "examples": [
              "2024-01-15T10:30:00Z"
            ],
            "minLength": 1,
            "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339."
          },
          "type": {
            "type": "string",
            "examples": [
              "com.qlik.v1.report.collected"
            ],
            "minLength": 1,
            "description": "Describes the type of event related to the originating occurrence."
          },
          "source": {
            "type": "string",
            "format": "uri-reference",
            "examples": [
              "com.qlik/reporting-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",
            "examples": [
              "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": {
          "host": {
            "type": "string",
            "examples": [
              "reporting-service-7d9f8c6b9c-abcde"
            ],
            "description": "The hostname of the event producer for example pod name."
          },
          "userid": {
            "type": "string",
            "examples": [
              "VZhiEfgW2bLd7HgR-jjzAh6VnicipweT"
            ],
            "description": "Unique identifier for the user triggering the event."
          },
          "authtype": {
            "type": "string",
            "examples": [
              "user"
            ],
            "description": "Representing the type of principal that triggered the occurrence."
          },
          "originip": {
            "type": "string",
            "examples": [
              "203.0.113.42"
            ],
            "description": "The origin host (hostname or IP address, optionally including a port) of the request that triggered the event, derived from the request's host."
          },
          "tenantid": {
            "type": "string",
            "examples": [
              "VZhiEfgW2bLd7HgR-jjzAh6VnicipweT"
            ],
            "description": "Unique identifier for the tenant related to the event."
          },
          "authclaims": {
            "type": "string",
            "examples": [
              "{\"sub\":\"VZhiEfgW2bLd7HgR-jjzAh6VnicipweT\"}"
            ],
            "description": "A JSON string representing claims of the principal that triggered the event."
          },
          "tracestate": {
            "type": "string",
            "examples": [
              "congo=t61rcWkgMzE"
            ],
            "description": "A comma-delimited list of key-value pairs."
          },
          "traceparent": {
            "type": "string",
            "examples": [
              "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
            ],
            "description": "Contains a version, trace ID, span ID, and trace options."
          },
          "toplevelresourceid": {
            "type": "string",
            "examples": [
              "ba2af9e6-0489-49a9-ae4d-8bf4a187f3c5"
            ],
            "description": "The top level resource id."
          }
        }
      },
      "compositionTemplates": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/template"
        },
        "description": "Array of templates defining a composition"
      },
      "consumption": {
        "type": "object",
        "required": [
          "startTime",
          "endTime",
          "exportDurationMsecs",
          "objectCount",
          "senseSheetCount",
          "tcsUploadTimeMsecs"
        ],
        "properties": {
          "level": {
            "$ref": "#/components/schemas/levelStat"
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "example": "2018-10-30T07:06:22Z",
            "description": "timestamp of when the response is ready."
          },
          "cellCount": {
            "type": "integer",
            "description": "cell count"
          },
          "startTime": {
            "type": "string",
            "format": "date-time",
            "example": "2018-10-30T07:06:22Z",
            "description": "timestamp of when the request arrives."
          },
          "objectCount": {
            "type": "integer",
            "description": "exported object count"
          },
          "maxCellCount": {
            "type": "integer",
            "description": "cell count of biggest data export"
          },
          "minCellCount": {
            "type": "integer",
            "description": "cell count of the smallest data export"
          },
          "variableCount": {
            "type": "integer",
            "description": "Variable count"
          },
          "taskRetryCount": {
            "type": "integer",
            "description": "Task retry count"
          },
          "senseSheetCount": {
            "type": "integer",
            "description": "Number of sheets in the request"
          },
          "dataDurationStat": {
            "$ref": "#/components/schemas/durationStat"
          },
          "queuingDelayStat": {
            "$ref": "#/components/schemas/durationStat"
          },
          "taskDurationStat": {
            "$ref": "#/components/schemas/taskDurationStat"
          },
          "chartDurationStat": {
            "$ref": "#/components/schemas/chartDurationStat"
          },
          "tcsUploadTimeMsecs": {
            "type": "integer",
            "description": "TCS upload time"
          },
          "exportDurationMsecs": {
            "type": "integer",
            "description": "export duration in milliseconds"
          },
          "openAppDurationStat": {
            "$ref": "#/components/schemas/durationStat"
          },
          "renderedDurationStat": {
            "$ref": "#/components/schemas/durationStat"
          },
          "applyFilterDurationStat": {
            "$ref": "#/components/schemas/durationStat"
          },
          "compositionDurationMsecs": {
            "type": "integer",
            "description": "composition duration in milliseconds"
          },
          "applyVariablesDurationStat": {
            "$ref": "#/components/schemas/durationStat"
          }
        },
        "description": "Details about report processing"
      },
      "dataExport": {
        "type": "object",
        "properties": {
          "vizType": {
            "type": "string",
            "description": "visualization type"
          },
          "cellCount": {
            "type": "integer",
            "description": "cell data count"
          },
          "rowNumber": {
            "type": "integer",
            "description": "number of data rows"
          },
          "columnNumber": {
            "type": "integer",
            "description": "number of data columns"
          }
        },
        "description": "Excel export info"
      },
      "dataPayload": {
        "type": "object",
        "examples": [
          {
            "reports": {
              "results": [
                {
                  "success": true,
                  "outputId": "Chart_image",
                  "timeMsecs": 150,
                  "serverError": false
                }
              ],
              "loadType": "batch",
              "templates": {
                "template": {
                  "appId": "ba2af9e6-0489-49a9-ae4d-8bf4a187f3c5",
                  "objectId": "uarJk",
                  "templateType": "sense-image-1.0"
                }
              },
              "templateType": "sense-image-1.0"
            },
            "traceId": "0af7651916cd43dd8448eb211c80319c",
            "version": "1.0.0",
            "reportId": "47604fcb-a07d-4549-92a4-38fe11e5eff8:0",
            "requestId": "47604fcb-a07d-4549-92a4-38fe11e5eff8",
            "consumption": {
              "endTime": "2018-10-30T07:06:22Z",
              "startTime": "2018-10-30T07:06:22Z",
              "objectCount": 1,
              "senseSheetCount": 1,
              "tcsUploadTimeMsecs": 20,
              "exportDurationMsecs": 500
            },
            "globalResult": "success",
            "browserLikeOrigin": true
          }
        ],
        "required": [
          "version",
          "requestId",
          "reportId",
          "browserLikeOrigin",
          "reports",
          "traceId",
          "globalResult",
          "consumption"
        ],
        "properties": {
          "act": {
            "$ref": "#/components/schemas/act"
          },
          "tags": {
            "$ref": "#/components/schemas/tags"
          },
          "issuer": {
            "type": "string",
            "example": "qlik.api.internal",
            "description": "The issuer of the request from the jwt"
          },
          "reports": {
            "$ref": "#/components/schemas/reports"
          },
          "subject": {
            "type": "string",
            "example": "0d5fff2b-8429-4184-b4e6-1bc08cd1c840",
            "description": "The subject of the request from the jwt"
          },
          "subtype": {
            "type": "string",
            "example": "service",
            "description": "The subtype of the request from the jwt"
          },
          "traceId": {
            "type": "string",
            "description": "telemetry trace ID"
          },
          "version": {
            "type": "string",
            "example": "1.5.0",
            "description": "Version of the EventType, it uses semantic versioning."
          },
          "clientId": {
            "type": "string",
            "example": "47604fcb-a07d-4549-92a4-38fe11e5eff8",
            "description": "The unique ID identifying the client"
          },
          "reportId": {
            "type": "string",
            "example": "47604fcb-a07d-4549-92a4-38fe11e5eff8:0",
            "description": "The unique ID identifying the report"
          },
          "requestId": {
            "type": "string",
            "example": "47604fcb-a07d-4549-92a4-38fe11e5eff8",
            "description": "The unique ID identifying the request"
          },
          "consumption": {
            "$ref": "#/components/schemas/consumption"
          },
          "originalURL": {
            "type": "string",
            "example": "https://www.example.app/endpoint",
            "description": "The Original URL of the caller."
          },
          "globalResult": {
            "enum": [
              "success",
              "partial",
              "failed"
            ],
            "type": "string",
            "description": "All reports succeeded is \"success\", all reports failed is \"failed\", else is \"partial\"."
          },
          "browserLikeOrigin": {
            "type": "boolean",
            "example": true,
            "description": "The flag indicating the request is likely coming from a client."
          }
        },
        "description": "The data payload for a report processing event."
      },
      "durationStat": {
        "type": "object",
        "properties": {
          "failedCount": {
            "type": "integer",
            "description": "The number of failed exports"
          },
          "sampleCount": {
            "type": "integer",
            "description": "Total sample count"
          },
          "maxDurationMsecs": {
            "type": "integer",
            "description": "Max duration in milliseconds"
          },
          "minDurationMsecs": {
            "type": "integer",
            "description": "Min duration in milliseconds"
          },
          "totDurationMsecs": {
            "type": "integer",
            "description": "Total duration in milliseconds"
          }
        },
        "description": "Details about report processing"
      },
      "error": {
        "type": "object",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string",
            "example": "REP-400000",
            "description": "The unique code for the error."
          },
          "chartId": {
            "type": "string",
            "description": "Chart id."
          },
          "chartType": {
            "type": "string",
            "description": "Chart type."
          }
        },
        "description": "Error occurred during report generation."
      },
      "errors": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/error"
        },
        "description": "Array of errors that occurred during report generation."
      },
      "levelStat": {
        "type": "object",
        "properties": {
          "levelCount": {
            "type": "integer",
            "description": "Level count"
          },
          "maxIteration": {
            "type": "integer",
            "description": "Max iterations"
          },
          "totIteration": {
            "type": "integer",
            "description": "Total iterations"
          },
          "maxNestedLevel": {
            "type": "integer",
            "description": "Max nested level"
          }
        },
        "description": "Level stats"
      },
      "metaReport": {
        "type": "object",
        "properties": {
          "outputTtlSecs": {
            "type": "integer",
            "description": "Seconds to live of the final result artifacts"
          },
          "exportDeadlineSecs": {
            "type": "integer",
            "description": "The maximum interval in seconds, starting from the time the API request is received, within which a report must be produced"
          }
        },
        "description": "Report meta info"
      },
      "reports": {
        "type": "object",
        "required": [
          "loadType",
          "results",
          "templateType",
          "templates"
        ],
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/metaReport"
          },
          "results": {
            "$ref": "#/components/schemas/results"
          },
          "loadType": {
            "type": "string",
            "example": "batch",
            "description": "The load type assigned to the request for pool assignment"
          },
          "templates": {
            "$ref": "#/components/schemas/templates"
          },
          "templateType": {
            "type": "string",
            "example": "sense-image-1.0",
            "description": "Template type and version using semantic versioning [composition-1.0 sense-image-1.0 sense-data-1.0 ... etc], Refer to API docs for the full list"
          }
        },
        "description": "The summary information on the triggered request"
      },
      "result": {
        "type": "object",
        "required": [
          "outputId",
          "success",
          "serverError",
          "timeMsecs"
        ],
        "properties": {
          "errors": {
            "$ref": "#/components/schemas/errors"
          },
          "format": {
            "type": "string",
            "description": "The output format"
          },
          "success": {
            "type": "boolean",
            "example": true,
            "description": "The flag indicating a successful report generation [true, false]"
          },
          "outputId": {
            "type": "string",
            "example": "Chart_image",
            "description": "The outputId [Chart_image, Chart_pdf, chart_excel, Sheet_pdf, Multisheet_PDF]."
          },
          "sizeBytes": {
            "type": "integer",
            "description": "output size in bytes"
          },
          "timeMsecs": {
            "type": "integer",
            "example": 150,
            "description": "The time elapsed in milliseconds"
          },
          "dataExport": {
            "$ref": "#/components/schemas/dataExport"
          },
          "serverError": {
            "type": "boolean",
            "description": "The flag indicating if there is a server/backend error"
          }
        },
        "description": "The object with information on report generation result."
      },
      "results": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/result"
        },
        "description": "Array of results that occurred during report generation."
      },
      "tag": {
        "type": "string",
        "example": "sense-dialog.download",
        "description": "A tag sent by a client. It is a string with the format \"feature.subfeature\". For more information please look at the document docs/meta-tags.md in the reporting-service repository."
      },
      "tags": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/tag"
        },
        "description": "Array of tags sent by requester client."
      },
      "taskDurationStat": {
        "type": "object",
        "description": "Type duration Map",
        "additionalProperties": {
          "$ref": "#/components/schemas/durationStat"
        }
      },
      "template": {
        "type": "object",
        "required": [
          "templateType",
          "appId",
          "objectId"
        ],
        "properties": {
          "appId": {
            "type": "string",
            "example": "ba2af9e6-0489-49a9-ae4d-8bf4a187f3c5",
            "description": "The unique identifier of the app the request is related to."
          },
          "objectId": {
            "type": "string",
            "example": "uarJk",
            "description": "The unique identifier of the app's object the report is related to."
          },
          "templateType": {
            "type": "string",
            "example": "sense-image-1.0",
            "description": "Template type and version using semantic versioning [composition-1.0 sense-image-1.0 sense-data-1.0 ... etc], Refer to API docs for the full list"
          }
        },
        "description": "The object with information for templateType"
      },
      "templates": {
        "type": "object",
        "properties": {
          "template": {
            "$ref": "#/components/schemas/template"
          },
          "compositionTemplates": {
            "$ref": "#/components/schemas/compositionTemplates"
          }
        },
        "description": "The templating parameter, it can be a single template or a composition of templates"
      }
    }
  }
}