{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/acronis/main/json-schema/acronis-activity-2-schema.json",
  "title": "activity_2",
  "description": "The activity object.",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/acronis-activities-api-openapi.yml#/components/schemas/activity_2",
  "type": "object",
  "required": [
    "state",
    "taskId",
    "tenant",
    "id",
    "createdAt",
    "updatedAt",
    "executor",
    "type"
  ],
  "properties": {
    "parentActivityId": {
      "description": "The ID of the parent activity.",
      "type": "integer"
    },
    "state": {
      "$ref": "#/$defs/executionState"
    },
    "taskId": {
      "description": "The ID of the task that is related to the activity.",
      "type": "integer"
    },
    "context": {
      "description": "Activity context."
    },
    "result": {
      "$ref": "#/$defs/executionResult"
    },
    "tenant": {
      "$ref": "#/$defs/tenant"
    },
    "startedAt": {
      "$ref": "#/$defs/time"
    },
    "id": {
      "description": "Unique numeric identifier for the activity object (server-generated).",
      "type": "integer"
    },
    "createdAt": {
      "$ref": "#/$defs/time"
    },
    "startedByUser": {
      "description": "The name of the user who created the activity.",
      "type": "string"
    },
    "completedAt": {
      "$ref": "#/$defs/time"
    },
    "resource": {
      "description": "The link to the resource which is related to the activity.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "name": {
          "$ref": "#/$defs/string256"
        },
        "id": {
          "$ref": "#/$defs/string64"
        },
        "type": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "uuid": {
      "description": "Universally unique identifier for the activity object. If not set, it will be automatically generated by the server.",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    },
    "progress": {
      "$ref": "#/$defs/progress"
    },
    "tags": {
      "description": "A list of user-defined tags.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/string64"
      }
    },
    "updatedAt": {
      "$ref": "#/$defs/time"
    },
    "executor": {
      "$ref": "#/$defs/actor"
    },
    "policy": {
      "description": "The link to the policy which execution requires to create the activity.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "name": {
          "$ref": "#/$defs/string256"
        },
        "id": {
          "$ref": "#/$defs/string64"
        },
        "type": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "workflowId": {
      "description": "The ID of the workflow that is related to the activity.",
      "type": "integer"
    },
    "type": {
      "description": "The type of the activity that is defined by the user.",
      "type": "string"
    }
  },
  "$defs": {
    "actor": {
      "description": "An actor identity.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/string64"
        },
        "clusterId": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "blob": {
      "description": "Arbitrary data."
    },
    "debugInfo": {
      "description": "Error debug information (map type)",
      "type": "object"
    },
    "domainError": {
      "description": "Base error object",
      "type": "object",
      "required": [
        "domain",
        "code"
      ],
      "properties": {
        "domain": {
          "description": "Error type or category. Can be ['Licensing','Access'] or name of service (for example 'PolicyManager' or 'VaultManager')",
          "type": "string"
        },
        "code": {
          "description": "Error id or code, unique in the domain. Same as in 'reason' field",
          "type": "string"
        },
        "reason": {
          "description": "Obsolete. Error id or code, unique in the domain. Same as in 'code' field",
          "type": "string"
        },
        "context": {
          "description": "Error context dictionary",
          "type": "object"
        },
        "kbLink": {
          "$ref": "#/$defs/kbLinkInfo"
        },
        "debug": {
          "$ref": "#/$defs/debugInfo"
        }
      }
    },
    "duration": {
      "description": "Duration in the human-readable format like \"1m\", \"10s\", \"1h25m43s\" where \"m\" = \"minutes\", \"s\" = \"seconds\", \"h\" = \"hours\".",
      "type": "string"
    },
    "executionBottleneck": {
      "description": "An execution bottleneck. The sum of all field values must equal 100.",
      "type": "object",
      "properties": {
        "source": {
          "description": "Bottleneck score when reading data.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "destination": {
          "description": "Bottleneck score when writing data.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "processing": {
          "description": "Bottleneck score during data processing on executor side.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "executionResult": {
      "description": "An execution result.",
      "type": "object",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "$ref": "#/$defs/resultCode"
        },
        "error": {
          "$ref": "#/$defs/domainError"
        },
        "warnings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/domainError"
          }
        },
        "payload": {
          "$ref": "#/$defs/blob"
        }
      }
    },
    "executionState": {
      "description": "An execution state.",
      "enum": [
        "enqueued",
        "assigned",
        "started",
        "paused",
        "completed"
      ],
      "type": "string"
    },
    "kbLinkInfo": {
      "description": "Components for kblink",
      "type": "object",
      "required": [
        "lineTag",
        "serCode",
        "version",
        "build",
        "product",
        "os"
      ],
      "properties": {
        "lineTag": {
          "type": "string"
        },
        "serCode": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "build": {
          "type": "integer"
        },
        "product": {
          "type": "string"
        },
        "os": {
          "type": "string"
        }
      }
    },
    "progress": {
      "description": "A progress value.",
      "type": "object",
      "required": [
        "total"
      ],
      "properties": {
        "current": {
          "type": "integer"
        },
        "bytesProcessed": {
          "type": "integer"
        },
        "processingSpeed": {
          "type": "number"
        },
        "leftTime": {
          "$ref": "#/$defs/duration"
        },
        "bytesSaved": {
          "type": "integer"
        },
        "bottleneck": {
          "$ref": "#/$defs/executionBottleneck"
        },
        "total": {
          "type": "integer"
        }
      }
    },
    "resultCode": {
      "enum": [
        "ok",
        "error",
        "warning",
        "cancelled",
        "abandoned",
        "timedout"
      ],
      "type": "string"
    },
    "string256": {
      "description": "A string that may contain up to 256 characters.",
      "type": "string"
    },
    "string64": {
      "description": "A string that may contain up to 64 characters.",
      "type": "string"
    },
    "tenant": {
      "description": "A tenant identity.",
      "type": "object",
      "required": [
        "id",
        "uuid"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/string64"
        },
        "uuid": {
          "$ref": "#/$defs/uuid"
        },
        "name": {
          "type": "string"
        },
        "locator": {
          "description": "A hierarchical tenant identifier in the following format - `/root-id/unit-id/sub-unit-id/tenant-id/`.",
          "type": "string"
        }
      }
    },
    "time": {
      "description": "Time in RFC3339 format.",
      "type": "string"
    },
    "uuid": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    }
  }
}