# 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.Storage.V1.Model.RewriteResponse do
  @moduledoc """
  A rewrite response.

  ## Attributes

  *   `done` (*type:* `boolean()`, *default:* `nil`) - true if the copy is finished; otherwise, false if the copy is in progress. This property is always present in the response.
  *   `kind` (*type:* `String.t`, *default:* `storage#rewriteResponse`) - The kind of item this is.
  *   `objectSize` (*type:* `String.t`, *default:* `nil`) - The total size of the object being copied in bytes. This property is always present in the response.
  *   `resource` (*type:* `GoogleApi.Storage.V1.Model.Object.t`, *default:* `nil`) - A resource containing the metadata for the copied-to object. This property is present in the response only when copying completes.
  *   `rewriteToken` (*type:* `String.t`, *default:* `nil`) - A token to use in subsequent requests to continue copying data. This token is present in the response only when there is more data to copy.
  *   `totalBytesRewritten` (*type:* `String.t`, *default:* `nil`) - The total bytes written so far, which can be used to provide a waiting user with a progress indicator. This property is always present in the response.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :done => boolean() | nil,
          :kind => String.t() | nil,
          :objectSize => String.t() | nil,
          :resource => GoogleApi.Storage.V1.Model.Object.t() | nil,
          :rewriteToken => String.t() | nil,
          :totalBytesRewritten => String.t() | nil
        }

  field(:done)
  field(:kind)
  field(:objectSize)
  field(:resource, as: GoogleApi.Storage.V1.Model.Object)
  field(:rewriteToken)
  field(:totalBytesRewritten)
end

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

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