syntax = "proto3";

package temporal.api.enums.v1;

option go_package = "go.temporal.io/api/enums/v1;enums";
option java_package = "io.temporal.api.enums.v1";
option java_multiple_files = true;
option java_outer_classname = "TaskQueueProto";
option ruby_package = "Temporalio::Api::Enums::V1";
option csharp_namespace = "Temporalio.Api.Enums.V1";

enum TaskQueueKind {
    // Tasks from any non workflow task may be unspecified.
    //
    // Task queue kind is used to differentiate whether a workflow task queue is sticky or 
    // normal. If a task is not a workflow task, Task queue kind will sometimes be 
    // unspecified.
    TASK_QUEUE_KIND_UNSPECIFIED = 0;
    // Tasks from a normal workflow task queue always include complete workflow history
    //
    // The task queue specified by the user is always a normal task queue. There can be as many
    // workers as desired for a single normal task queue. All those workers may pick up tasks from
    // that queue.
    TASK_QUEUE_KIND_NORMAL = 1;
    // A sticky queue only includes new history since the last workflow task, and they are
    // per-worker.
    //
    // Sticky queues are created dynamically by each worker during their start up. They only exist
    // for the lifetime of the worker process. Tasks in a sticky task queue are only available to
    // the worker that created the sticky queue.
    //
    // Sticky queues are only for workflow tasks. There are no sticky task queues for activities.
    TASK_QUEUE_KIND_STICKY = 2;
    // A worker-commands task queue is used for server-to-worker communication (e.g. activity
    // cancellations). These queues are ephemeral and per-worker-process — they exist only for
    // the lifetime of the worker process. Used with TASK_QUEUE_TYPE_NEXUS and polled via
    // PollNexusTaskQueue.
    TASK_QUEUE_KIND_WORKER_COMMANDS = 3;
}

enum TaskQueueType {
    TASK_QUEUE_TYPE_UNSPECIFIED = 0;
    // Workflow type of task queue.
    TASK_QUEUE_TYPE_WORKFLOW = 1;
    // Activity type of task queue.
    TASK_QUEUE_TYPE_ACTIVITY = 2;
    // Task queue type for dispatching Nexus requests.
    TASK_QUEUE_TYPE_NEXUS = 3;
}

// Specifies which category of tasks may reach a worker on a versioned task queue.
// Used both in a reachability query and its response.
// Deprecated.
enum TaskReachability {
    TASK_REACHABILITY_UNSPECIFIED = 0;
    // There's a possiblity for a worker to receive new workflow tasks. Workers should *not* be retired.
    TASK_REACHABILITY_NEW_WORKFLOWS = 1;
    // There's a possiblity for a worker to receive existing workflow and activity tasks from existing workflows. Workers
    // should *not* be retired.
    // This enum value does not distinguish between open and closed workflows.
    TASK_REACHABILITY_EXISTING_WORKFLOWS = 2;
    // There's a possiblity for a worker to receive existing workflow and activity tasks from open workflows. Workers
    // should *not* be retired.
    TASK_REACHABILITY_OPEN_WORKFLOWS = 3;
    // There's a possiblity for a worker to receive existing workflow tasks from closed workflows. Workers may be
    // retired dependending on application requirements. For example, if there's no need to query closed workflows.
    TASK_REACHABILITY_CLOSED_WORKFLOWS = 4;
}

// Specifies which category of tasks may reach a versioned worker of a certain Build ID.
//
// Task Reachability is eventually consistent; there may be a delay (up to few minutes) until it
// converges to the most accurate value but it is designed in a way to take the more conservative
// side until it converges. For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
//
// Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
// accounted for reachability as server cannot know if they'll happen as they do not use
// assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
// who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
// sure to query reachability for the parent/previous workflow's Task Queue as well.
enum BuildIdTaskReachability {
    // Task reachability is not reported
    BUILD_ID_TASK_REACHABILITY_UNSPECIFIED = 0;
    // Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
    // be open workflows or backlogged activities assigned to it.
    BUILD_ID_TASK_REACHABILITY_REACHABLE = 1;
    // Build ID does not have open workflows and is not reachable by new workflows,
    // but MAY have closed workflows within the namespace retention period.
    // Not applicable to activity-only task queues.
    BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY = 2;
    // Build ID is not used for new executions, nor it has been used by any existing execution
    // within the retention period.
    BUILD_ID_TASK_REACHABILITY_UNREACHABLE = 3;
}

enum DescribeTaskQueueMode {
    // Unspecified means legacy behavior.
    DESCRIBE_TASK_QUEUE_MODE_UNSPECIFIED = 0;
    // Enhanced mode reports aggregated results for all partitions, supports Build IDs, and reports richer info.
    DESCRIBE_TASK_QUEUE_MODE_ENHANCED = 1;
}

// Source for the effective rate limit.
enum RateLimitSource {
    RATE_LIMIT_SOURCE_UNSPECIFIED = 0;
    // The value was set by the API.
    RATE_LIMIT_SOURCE_API = 1;
    // The value was set by a worker.
    RATE_LIMIT_SOURCE_WORKER = 2;
    // The value was set as the system default.
    RATE_LIMIT_SOURCE_SYSTEM = 3;
}

// Indicates whether a change to the Routing Config has been
// propagated to all relevant Task Queues and their partitions.
enum RoutingConfigUpdateState {
    ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED = 0;
    // Update to the RoutingConfig is currently in progress.
    ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS = 1;
    // Update to the RoutingConfig has completed successfully.
    ROUTING_CONFIG_UPDATE_STATE_COMPLETED = 2;
}
