# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudTasks.V2beta2.Model.QueueStats do
  @moduledoc """
  Statistics for a queue.

  ## Attributes

  *   `concurrentDispatchesCount` (*type:* `String.t`, *default:* `nil`) - Output only. The number of requests that the queue has dispatched but has not received a reply for yet.
  *   `effectiveExecutionRate` (*type:* `float()`, *default:* `nil`) - Output only. The current maximum number of tasks per second executed by the queue. The maximum value of this variable is controlled by the RateLimits of the Queue. However, this value could be less to avoid overloading the endpoints tasks in the queue are targeting.
  *   `executedLastMinuteCount` (*type:* `String.t`, *default:* `nil`) - Output only. The number of tasks that the queue has dispatched and received a reply for during the last minute. This variable counts both successful and non-successful executions.
  *   `oldestEstimatedArrivalTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. An estimation of the nearest time in the future where a task in the queue is scheduled to be executed.
  *   `tasksCount` (*type:* `String.t`, *default:* `nil`) - Output only. An estimation of the number of tasks in the queue, that is, the tasks in the queue that haven't been executed, the tasks in the queue which the queue has dispatched but has not yet received a reply for, and the failed tasks that the queue is retrying.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :concurrentDispatchesCount => String.t() | nil,
          :effectiveExecutionRate => float() | nil,
          :executedLastMinuteCount => String.t() | nil,
          :oldestEstimatedArrivalTime => DateTime.t() | nil,
          :tasksCount => String.t() | nil
        }

  field(:concurrentDispatchesCount)
  field(:effectiveExecutionRate)
  field(:executedLastMinuteCount)
  field(:oldestEstimatedArrivalTime, as: DateTime)
  field(:tasksCount)
end

defimpl Poison.Decoder, for: GoogleApi.CloudTasks.V2beta2.Model.QueueStats do
  def decode(value, options) do
    GoogleApi.CloudTasks.V2beta2.Model.QueueStats.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudTasks.V2beta2.Model.QueueStats do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
