// This file is @generated by prost-build.
/// See <https://docs.temporal.io/docs/concepts/task-queues/>
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueue {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Default: TASK_QUEUE_KIND_NORMAL.
    #[prost(enumeration = "super::super::enums::v1::TaskQueueKind", tag = "2")]
    pub kind: i32,
    /// Iff kind == TASK_QUEUE_KIND_STICKY, then this field contains the name of
    /// the normal task queue that the sticky worker is running on.
    #[prost(string, tag = "3")]
    pub normal_name: ::prost::alloc::string::String,
}
/// Only applies to activity task queues
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TaskQueueMetadata {
    /// Allows throttling dispatch of tasks from this queue
    #[prost(message, optional, tag = "1")]
    pub max_tasks_per_second: ::core::option::Option<f64>,
}
/// Experimental. Worker Deployments are experimental and might significantly change in the future.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueVersioningInfo {
    /// Specifies which Deployment Version should receive new workflow executions and tasks of
    /// existing unversioned or AutoUpgrade workflows.
    /// Nil value represents all the unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
    /// Note: Current Version is overridden by the Ramping Version for a portion of traffic when ramp percentage
    /// is non-zero (see `ramping_deployment_version` and `ramping_version_percentage`).
    #[prost(message, optional, tag = "7")]
    pub current_deployment_version: ::core::option::Option<
        super::super::deployment::v1::WorkerDeploymentVersion,
    >,
    /// Deprecated. Use `current_deployment_version`.
    #[deprecated]
    #[prost(string, tag = "1")]
    pub current_version: ::prost::alloc::string::String,
    /// When ramp percentage is non-zero, that portion of traffic is shifted from the Current Version to the Ramping Version.
    /// Must always be different from `current_deployment_version` unless both are nil.
    /// Nil value represents all the unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
    /// Note that it is possible to ramp from one Version to another Version, or from unversioned
    /// workers to a particular Version, or from a particular Version to unversioned workers.
    #[prost(message, optional, tag = "9")]
    pub ramping_deployment_version: ::core::option::Option<
        super::super::deployment::v1::WorkerDeploymentVersion,
    >,
    /// Deprecated. Use `ramping_deployment_version`.
    #[deprecated]
    #[prost(string, tag = "2")]
    pub ramping_version: ::prost::alloc::string::String,
    /// Percentage of tasks that are routed to the Ramping Version instead of the Current Version.
    /// Valid range: \[0, 100\]. A 100% value means the Ramping Version is receiving full traffic but
    /// not yet "promoted" to be the Current Version, likely due to pending validations.
    /// A 0% value means the Ramping Version is receiving no traffic.
    #[prost(float, tag = "3")]
    pub ramping_version_percentage: f32,
    /// Last time versioning information of this Task Queue changed.
    #[prost(message, optional, tag = "4")]
    pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Used for specifying versions the caller is interested in.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueVersionSelection {
    /// Include specific Build IDs.
    #[prost(string, repeated, tag = "1")]
    pub build_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Include the unversioned queue.
    #[prost(bool, tag = "2")]
    pub unversioned: bool,
    /// Include all active versions. A version is considered active if, in the last few minutes,
    /// it has had new tasks or polls, or it has been the subject of certain task queue API calls.
    #[prost(bool, tag = "3")]
    pub all_active: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueVersionInfo {
    /// Task Queue info per Task Type. Key is the numerical value of the temporal.api.enums.v1.TaskQueueType enum.
    #[prost(map = "int32, message", tag = "1")]
    pub types_info: ::std::collections::HashMap<i32, TaskQueueTypeInfo>,
    /// Task Reachability is eventually consistent; there may be a delay 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.
    #[prost(enumeration = "super::super::enums::v1::BuildIdTaskReachability", tag = "2")]
    pub task_reachability: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueTypeInfo {
    /// Unversioned workers (with `useVersioning=false`) are reported in unversioned result even if they set a Build ID.
    #[prost(message, repeated, tag = "1")]
    pub pollers: ::prost::alloc::vec::Vec<PollerInfo>,
    #[prost(message, optional, tag = "2")]
    pub stats: ::core::option::Option<TaskQueueStats>,
}
/// TaskQueueStats contains statistics about task queue backlog and activity.
///
/// For workflow task queue type, this result is partial because tasks sent to sticky queues are not included. Read
/// comments above each metric to understand the impact of sticky queue exclusion on that metric accuracy.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TaskQueueStats {
    /// The approximate number of tasks backlogged in this task queue. May count expired tasks but eventually
    /// converges to the right value. Can be relied upon for scaling decisions.
    ///
    /// Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because
    /// those tasks only remain valid for a few seconds, the inaccuracy becomes less significant as the backlog size
    /// grows.
    #[prost(int64, tag = "1")]
    pub approximate_backlog_count: i64,
    /// Approximate age of the oldest task in the backlog based on the creation time of the task at the head of
    /// the queue. Can be relied upon for scaling decisions.
    ///
    /// Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because
    /// those tasks only remain valid for a few seconds, they should not affect the result when backlog is older than
    /// few seconds.
    #[prost(message, optional, tag = "2")]
    pub approximate_backlog_age: ::core::option::Option<::prost_types::Duration>,
    /// The approximate tasks per second added to the task queue, averaging the last 30 seconds. These includes tasks
    /// whether or not they were added to/dispatched from the backlog or they were dispatched immediately without going
    /// to the backlog (sync-matched).
    ///
    /// The difference between `tasks_add_rate` and `tasks_dispatch_rate` is a reliable metric for the rate at which
    /// backlog grows/shrinks.
    ///
    /// Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by
    /// tasks_add_rate, because:
    /// - Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is
    ///    enable for activities by default in the latest SDKs.
    /// - Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each
    ///    workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific
    ///    worker instance.
    #[prost(float, tag = "3")]
    pub tasks_add_rate: f32,
    /// The approximate tasks per second dispatched from the task queue, averaging the last 30 seconds. These includes
    /// tasks whether or not they were added to/dispatched from the backlog or they were dispatched immediately without
    /// going to the backlog (sync-matched).
    ///
    /// The difference between `tasks_add_rate` and `tasks_dispatch_rate` is a reliable metric for the rate at which
    /// backlog grows/shrinks.
    ///
    /// Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by
    /// tasks_dispatch_rate, because:
    /// - Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is
    ///    enable for activities by default in the latest SDKs.
    /// - Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each
    ///    workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific
    ///    worker instance.
    #[prost(float, tag = "4")]
    pub tasks_dispatch_rate: f32,
}
/// Deprecated. Use `InternalTaskQueueStatus`. This is kept until `DescribeTaskQueue` supports legacy behavior.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TaskQueueStatus {
    #[prost(int64, tag = "1")]
    pub backlog_count_hint: i64,
    #[prost(int64, tag = "2")]
    pub read_level: i64,
    #[prost(int64, tag = "3")]
    pub ack_level: i64,
    #[prost(double, tag = "4")]
    pub rate_per_second: f64,
    #[prost(message, optional, tag = "5")]
    pub task_id_block: ::core::option::Option<TaskIdBlock>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TaskIdBlock {
    #[prost(int64, tag = "1")]
    pub start_id: i64,
    #[prost(int64, tag = "2")]
    pub end_id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueuePartitionMetadata {
    #[prost(string, tag = "1")]
    pub key: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub owner_host_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PollerInfo {
    #[prost(message, optional, tag = "1")]
    pub last_access_time: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(string, tag = "2")]
    pub identity: ::prost::alloc::string::String,
    #[prost(double, tag = "3")]
    pub rate_per_second: f64,
    /// If a worker has opted into the worker versioning feature while polling, its capabilities will
    /// appear here.
    /// Deprecated. Replaced by deployment_options.
    #[deprecated]
    #[prost(message, optional, tag = "4")]
    pub worker_version_capabilities: ::core::option::Option<
        super::super::common::v1::WorkerVersionCapabilities,
    >,
    /// Worker deployment options that SDK sent to server.
    #[prost(message, optional, tag = "5")]
    pub deployment_options: ::core::option::Option<
        super::super::deployment::v1::WorkerDeploymentOptions,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StickyExecutionAttributes {
    #[prost(message, optional, tag = "1")]
    pub worker_task_queue: ::core::option::Option<TaskQueue>,
    /// (-- api-linter: core::0140::prepositions=disabled
    ///      aip.dev/not-precedent: "to" is used to indicate interval. --)
    #[prost(message, optional, tag = "2")]
    pub schedule_to_start_timeout: ::core::option::Option<::prost_types::Duration>,
}
/// Used by the worker versioning APIs, represents an unordered set of one or more versions which are
/// considered to be compatible with each other. Currently the versions are always worker build IDs.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompatibleVersionSet {
    /// All the compatible versions, unordered, except for the last element, which is considered the set "default".
    #[prost(string, repeated, tag = "1")]
    pub build_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Reachability of tasks for a worker on a single task queue.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueReachability {
    #[prost(string, tag = "1")]
    pub task_queue: ::prost::alloc::string::String,
    /// Task reachability for a worker in a single task queue.
    /// See the TaskReachability docstring for information about each enum variant.
    /// If reachability is empty, this worker is considered unreachable in this task queue.
    #[prost(
        enumeration = "super::super::enums::v1::TaskReachability",
        repeated,
        tag = "2"
    )]
    pub reachability: ::prost::alloc::vec::Vec<i32>,
}
/// Reachability of tasks for a worker by build id, in one or more task queues.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BuildIdReachability {
    /// A build id or empty if unversioned.
    #[prost(string, tag = "1")]
    pub build_id: ::prost::alloc::string::String,
    /// Reachability per task queue.
    #[prost(message, repeated, tag = "2")]
    pub task_queue_reachability: ::prost::alloc::vec::Vec<TaskQueueReachability>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RampByPercentage {
    /// Acceptable range is [0,100).
    #[prost(float, tag = "1")]
    pub ramp_percentage: f32,
}
/// Assignment rules are applied to *new* Workflow and Activity executions at
/// schedule time to assign them to a Build ID.
///
/// Assignment rules will not be used in the following cases:
///     - Child Workflows or Continue-As-New Executions who inherit their
///       parent/previous Workflow's assigned Build ID (by setting the
///       `inherit_build_id` flag - default behavior in SDKs when the same Task Queue
///       is used.)
///     - An Activity that inherits the assigned Build ID of its Workflow (by
///       setting the `use_workflow_build_id` flag - default behavior in SDKs
///       when the same Task Queue is used.)
///
/// In absence of (applicable) redirect rules (`CompatibleBuildIdRedirectRule`s)
/// the task will be dispatched to Workers of the Build ID determined by the
/// assignment rules (or inherited). Otherwise, the final Build ID will be
/// determined by the redirect rules.
///
/// Once a Workflow completes its first Workflow Task in a particular Build ID it
/// stays in that Build ID regardless of changes to assignment rules. Redirect
/// rules can be used to move the workflow to another compatible Build ID.
///
/// When using Worker Versioning on a Task Queue, in the steady state,
/// there should typically be a single assignment rule to send all new executions
/// to the latest Build ID. Existence of at least one such "unconditional"
/// rule at all times is enforces by the system, unless the `force` flag is used
/// by the user when replacing/deleting these rules (for exceptional cases).
///
/// During a deployment, one or more additional rules can be added to assign a
/// subset of the tasks to a new Build ID based on a "ramp percentage".
///
/// When there are multiple assignment rules for a Task Queue, the rules are
/// evaluated in order, starting from index 0. The first applicable rule will be
/// applied and the rest will be ignored.
///
/// In the event that no assignment rule is applicable on a task (or the Task
/// Queue is simply not versioned), the tasks will be dispatched to an
/// unversioned Worker.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BuildIdAssignmentRule {
    #[prost(string, tag = "1")]
    pub target_build_id: ::prost::alloc::string::String,
    /// If a ramp is provided, this rule will be applied only to a sample of
    /// tasks according to the provided percentage.
    /// This option can be used only on "terminal" Build IDs (the ones not used
    /// as source in any redirect rules).
    #[prost(oneof = "build_id_assignment_rule::Ramp", tags = "3")]
    pub ramp: ::core::option::Option<build_id_assignment_rule::Ramp>,
}
/// Nested message and enum types in `BuildIdAssignmentRule`.
pub mod build_id_assignment_rule {
    /// If a ramp is provided, this rule will be applied only to a sample of
    /// tasks according to the provided percentage.
    /// This option can be used only on "terminal" Build IDs (the ones not used
    /// as source in any redirect rules).
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Ramp {
        /// This ramp is useful for gradual Blue/Green deployments (and similar)
        /// where you want to send a certain portion of the traffic to the target
        /// Build ID.
        #[prost(message, tag = "3")]
        PercentageRamp(super::RampByPercentage),
    }
}
/// These rules apply to tasks assigned to a particular Build ID
/// (`source_build_id`) to redirect them to another *compatible* Build ID
/// (`target_build_id`).
///
/// It is user's responsibility to ensure that the target Build ID is compatible
/// with the source Build ID (e.g. by using the Patching API).
///
/// Most deployments are not expected to need these rules, however following
/// situations can greatly benefit from redirects:
///   - Need to move long-running Workflow Executions from an old Build ID to a
///     newer one.
///   - Need to hotfix some broken or stuck Workflow Executions.
///
/// In steady state, redirect rules are beneficial when dealing with old
/// Executions ran on now-decommissioned Build IDs:
///   - To redirecting the Workflow Queries to the current (compatible) Build ID.
///   - To be able to Reset an old Execution so it can run on the current
///     (compatible) Build ID.
///
/// Redirect rules can be chained.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompatibleBuildIdRedirectRule {
    #[prost(string, tag = "1")]
    pub source_build_id: ::prost::alloc::string::String,
    /// Target Build ID must be compatible with the Source Build ID; that is it
    /// must be able to process event histories made by the Source Build ID by
    /// using [Patching](<https://docs.temporal.io/workflows#patching>) or other
    /// means.
    #[prost(string, tag = "2")]
    pub target_build_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimestampedBuildIdAssignmentRule {
    #[prost(message, optional, tag = "1")]
    pub rule: ::core::option::Option<BuildIdAssignmentRule>,
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimestampedCompatibleBuildIdRedirectRule {
    #[prost(message, optional, tag = "1")]
    pub rule: ::core::option::Option<CompatibleBuildIdRedirectRule>,
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Attached to task responses to give hints to the SDK about how it may adjust its number of
/// pollers.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PollerScalingDecision {
    /// How many poll requests to suggest should be added or removed, if any. As of now, server only
    /// scales up or down by 1. However, SDKs should allow for other values (while staying within
    /// defined min/max).
    ///
    /// The SDK is free to ignore this suggestion, EX: making more polls would not make sense because
    /// all slots are already occupied.
    #[prost(int32, tag = "1")]
    pub poll_request_delta_suggestion: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RateLimit {
    /// Zero is a valid rate limit.
    #[prost(float, tag = "1")]
    pub requests_per_second: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfigMetadata {
    /// Reason for why the config was set.
    #[prost(string, tag = "1")]
    pub reason: ::prost::alloc::string::String,
    /// Identity of the last updater.
    /// Set by the request's identity field.
    #[prost(string, tag = "2")]
    pub update_identity: ::prost::alloc::string::String,
    /// Time of the last update.
    #[prost(message, optional, tag = "3")]
    pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RateLimitConfig {
    #[prost(message, optional, tag = "1")]
    pub rate_limit: ::core::option::Option<RateLimit>,
    #[prost(message, optional, tag = "2")]
    pub metadata: ::core::option::Option<ConfigMetadata>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskQueueConfig {
    /// Unless modified, this is the system-defined rate limit.
    #[prost(message, optional, tag = "1")]
    pub queue_rate_limit: ::core::option::Option<RateLimitConfig>,
    /// If set, each individual fairness key will be limited to this rate, scaled by the weight of the fairness key.
    #[prost(message, optional, tag = "2")]
    pub fairness_keys_rate_limit_default: ::core::option::Option<RateLimitConfig>,
    /// If set, overrides the fairness weights for the corresponding fairness keys.
    #[prost(map = "string, float", tag = "3")]
    pub fairness_weight_overrides: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        f32,
    >,
}
