{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/kontaktio/main/json-schema/kontaktio-device-access-bulk-job-response-schema.json",
  "title": "DeviceAccessBulkJobResponse",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kontaktio-device-api-openapi.yml#/components/schemas/DeviceAccessBulkJobResponse",
  "type": "object",
  "properties": {
    "jobKey": {
      "type": "string",
      "description": "Identifier of the job"
    },
    "status": {
      "$ref": "#/$defs/JobStatus"
    },
    "progress": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "description": "Progress of the device access bulk process"
    },
    "result": {
      "type": "object",
      "properties": {
        "devicesRequested": {
          "type": "number",
          "description": "Number of devices requested with the BQL"
        },
        "accessGranted": {
          "type": "number",
          "description": "Number of devices that the access has been granted for"
        },
        "accessGrantFailed": {
          "type": "number",
          "description": "Number of devices that the access grant failed for"
        },
        "accessRevoked": {
          "type": "number",
          "description": "Number of devices that the access has been revoked for"
        },
        "accessRevokeFailed": {
          "type": "number",
          "description": "Number of devices that the access revoke failed for"
        },
        "devicesInaccessible": {
          "type": "number",
          "description": "Number of devices that are inaccessible with provided BQL, e.g. insufficient permissions"
        }
      }
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "VALIDATION_FAILED",
              "OBJECT_DOES_NOT_EXIST",
              "UNKNOWN_ERROR"
            ]
          },
          "fieldName": {
            "type": "string",
            "description": "Name of the field with error"
          },
          "errorMessage": {
            "description": "Error message"
          }
        }
      }
    }
  },
  "$defs": {
    "JobStatus": {
      "type": "string",
      "description": "Job status.",
      "enum": [
        "IN_PROGRESS",
        "COMPLETED",
        "NOT_FOUND",
        "FAILED"
      ]
    }
  }
}