# 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.VMMigration.V1.Model.ReplicationCycle do
  @moduledoc """
  ReplicationCycle contains information about the current replication cycle status.

  ## Attributes

  *   `cycleNumber` (*type:* `integer()`, *default:* `nil`) - The cycle's ordinal number.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - The time the replication cycle has ended.
  *   `error` (*type:* `GoogleApi.VMMigration.V1.Model.Status.t`, *default:* `nil`) - Output only. Provides details on the state of the cycle in case of an error.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The identifier of the ReplicationCycle.
  *   `progressPercent` (*type:* `integer()`, *default:* `nil`) - The current progress in percentage of this cycle. Was replaced by 'steps' field, which breaks down the cycle progression more accurately.
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - The time the replication cycle has started.
  *   `state` (*type:* `String.t`, *default:* `nil`) - State of the ReplicationCycle.
  *   `steps` (*type:* `list(GoogleApi.VMMigration.V1.Model.CycleStep.t)`, *default:* `nil`) - The cycle's steps list representing its progress.
  *   `totalPauseDuration` (*type:* `String.t`, *default:* `nil`) - The accumulated duration the replication cycle was paused.
  *   `warnings` (*type:* `list(GoogleApi.VMMigration.V1.Model.MigrationWarning.t)`, *default:* `nil`) - Output only. Warnings that occurred during the cycle.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cycleNumber => integer() | nil,
          :endTime => DateTime.t() | nil,
          :error => GoogleApi.VMMigration.V1.Model.Status.t() | nil,
          :name => String.t() | nil,
          :progressPercent => integer() | nil,
          :startTime => DateTime.t() | nil,
          :state => String.t() | nil,
          :steps => list(GoogleApi.VMMigration.V1.Model.CycleStep.t()) | nil,
          :totalPauseDuration => String.t() | nil,
          :warnings => list(GoogleApi.VMMigration.V1.Model.MigrationWarning.t()) | nil
        }

  field(:cycleNumber)
  field(:endTime, as: DateTime)
  field(:error, as: GoogleApi.VMMigration.V1.Model.Status)
  field(:name)
  field(:progressPercent)
  field(:startTime, as: DateTime)
  field(:state)
  field(:steps, as: GoogleApi.VMMigration.V1.Model.CycleStep, type: :list)
  field(:totalPauseDuration)
  field(:warnings, as: GoogleApi.VMMigration.V1.Model.MigrationWarning, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.VMMigration.V1.Model.ReplicationCycle do
  def decode(value, options) do
    GoogleApi.VMMigration.V1.Model.ReplicationCycle.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VMMigration.V1.Model.ReplicationCycle do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
