# 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.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfig do
  @moduledoc """
  The configuration for auto rollout.

  ## Attributes

  *   `failureCondition` (*type:* `String.t`, *default:* `nil`) - The conditions that are used to evaluate the failure of a rollout step. If not specified, no rollout steps will fail. E.g. "containment_rate < 10% OR average_turn_count < 3". See the [conditions reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  *   `rolloutCondition` (*type:* `String.t`, *default:* `nil`) - The conditions that are used to evaluate the success of a rollout step. If not specified, all rollout steps will proceed to the next one unless failure conditions are met. E.g. "containment_rate > 60% AND callback_rate < 20%". See the [conditions reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  *   `rolloutSteps` (*type:* `list(GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfigRolloutStep.t)`, *default:* `nil`) - Steps to roll out a flow version. Steps should be sorted by percentage in ascending order.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :failureCondition => String.t() | nil,
          :rolloutCondition => String.t() | nil,
          :rolloutSteps =>
            list(
              GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfigRolloutStep.t()
            )
            | nil
        }

  field(:failureCondition)
  field(:rolloutCondition)

  field(:rolloutSteps,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfigRolloutStep,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfig do
  def decode(value, options) do
    GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3RolloutConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
