{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/confighub/json-schema/confighub-queued-operation-schema.json",
  "title": "QueuedOperation",
  "description": "UnitAction is a record of an operation queued for a Worker, such as a function invocation on a unit. Operations are delivered to the worker in creation order; if the worker is disconnected, pending operations are delivered when it reconnects. One or more UnitEvents will correspond to each UnitAction.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/confighub-queuedoperation-api-openapi.yml#/components/schemas/QueuedOperation",
  "type": "object",
  "properties": {
    "Action": {
      "allOf": [
        {
          "$ref": "#/$defs/ActionType"
        }
      ],
      "description": "Action is the type of action to be performed by the worker, such as InvokeFunctions or Cancel. UnitActions queued for bridge workers, which have been removed, can carry the actions they performed, such as Apply.",
      "x-confighub-where": {
        "dataType": "string"
      }
    },
    "BridgeWorkerID": {
      "type": "string",
      "description": "BridgeWorkerID is the unique identifier of the worker that will process this operation.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "BridgeWorker"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "CreatedAt": {
      "type": "string",
      "description": "The timestamp when the entity was created in \"2023-01-01T12:00:00Z\" format.",
      "format": "date-time",
      "x-confighub-where": {
        "dataType": "time"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "Data": {
      "type": "string",
      "description": "Data is the result the worker reported for a finished function invocation: its FunctionInvocationResponse, as JSON.",
      "format": "base64",
      "x-go-type-skip-optional-pointer": true
    },
    "Dependencies": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/UUID"
      },
      "description": "Unused. No longer populated or consulted for delivery; retained for schema compatibility and scheduled for removal.",
      "x-go-type-skip-optional-pointer": true
    },
    "DryRun": {
      "type": "boolean",
      "description": "DryRun indicates whether the action is a dry run.",
      "x-confighub-where": {
        "dataType": "bool"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "ErrorDetails": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ErrorItem"
      },
      "description": "Error details returned by the worker.",
      "x-go-type-skip-optional-pointer": true
    },
    "ExtraParams": {
      "type": "string",
      "description": "ExtraParams contains additional parameters for the operation in string format.",
      "x-go-type-skip-optional-pointer": true
    },
    "OrganizationID": {
      "type": "string",
      "description": "OrganizationID is the unique identifier of the organization this operation belongs to.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Organization"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "QueuedOperationID": {
      "type": "string",
      "description": "QueuedOperationID is the unique identifier for the queued unit action.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "RevisionNum": {
      "type": "integer",
      "description": "RevisionNum is the revision number this operation was performed on.",
      "format": "int64",
      "x-confighub-where": {
        "dataType": "int"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "SpaceID": {
      "type": "string",
      "description": "SpaceID is the unique identifier of the space of the unit this operation is performed on.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Space"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "Status": {
      "enum": [
        "Initializing",
        "Pending",
        "Delivered",
        "Progressing",
        "Completed",
        "Failed",
        "Aborted",
        "Canceled",
        "pending",
        "delivered"
      ],
      "type": "string",
      "description": "Status indicates the current status of the unit action. v2 statuses: Initializing (being set up), Pending (waiting), Delivered (sent to worker), Progressing (being processed), Completed (success), Failed (error). v1 compatibility: 'pending' = Pending, 'delivered' = Completed (legacy 'delivered' meant work done).",
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "TargetID": {
      "type": "string",
      "description": "TargetID is the unique identifier of the target this operation is directed to.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Target"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "UnitActionNum": {
      "type": "integer",
      "description": "UnitActionNum is the sequence number of this unit action.",
      "format": "int64",
      "x-confighub-where": {
        "dataType": "int"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "UnitID": {
      "type": "string",
      "description": "UnitID is the unique identifier of the unit this operation is performed on.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Unit"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "UserAgent": {
      "type": "string",
      "description": "User-Agent string of the API call.",
      "x-go-type-skip-optional-pointer": true
    },
    "UserID": {
      "type": "string",
      "description": "UserID of the user the action was performed by.",
      "format": "uuid",
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "UserIsBot": {
      "type": "boolean",
      "description": "Whether the user who requested the action is a bot user.",
      "x-go-type-skip-optional-pointer": true
    },
    "UserRole": {
      "type": "string",
      "description": "Organization-level role of the user who requested the action.",
      "x-go-type-skip-optional-pointer": true
    },
    "Version": {
      "type": "integer",
      "description": "An entity-specific sequence number used for optimistic concurrency control.\nThe value read must be sent in calls to Update.",
      "format": "int64",
      "x-go-type-skip-optional-pointer": true
    }
  },
  "$defs": {
    "ActionType": {
      "enum": [
        "N/A",
        "Cancel",
        "InvokeFunctions",
        "ListFunctions",
        "Apply"
      ],
      "type": "string"
    },
    "ErrorItem": {
      "type": "object",
      "properties": {
        "Description": {
          "type": "string",
          "description": "A clear explanation of what went wrong",
          "x-go-type-skip-optional-pointer": true
        },
        "Item": {
          "type": "string",
          "description": "The name of the field, resource, or entity that the error relates to",
          "x-go-type-skip-optional-pointer": true
        }
      }
    },
    "UUID": {
      "type": "string",
      "format": "uuid"
    }
  }
}