# 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.DLP.V2.Model.GooglePrivacyDlpV2TransformationDetails do
  @moduledoc """
  Details about a single transformation. This object contains a description of the transformation, information about whether the transformation was successfully applied, and the precise location where the transformation occurred. These details are stored in a user-specified BigQuery table.

  ## Attributes

  *   `containerName` (*type:* `String.t`, *default:* `nil`) - The top level name of the container where the transformation is located (this will be the source file name or table name).
  *   `resourceName` (*type:* `String.t`, *default:* `nil`) - The name of the job that completed the transformation.
  *   `statusDetails` (*type:* `GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationResultStatus.t`, *default:* `nil`) - Status of the transformation, if transformation was not successful, this will specify what caused it to fail, otherwise it will show that the transformation was successful.
  *   `transformation` (*type:* `list(GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDescription.t)`, *default:* `nil`) - Description of transformation. This would only contain more than one element if there were multiple matching transformations and which one to apply was ambiguous. Not set for states that contain no transformation, currently only state that contains no transformation is TransformationResultStateType.METADATA_UNRETRIEVABLE.
  *   `transformationLocation` (*type:* `GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationLocation.t`, *default:* `nil`) - The precise location of the transformed content in the original container.
  *   `transformedBytes` (*type:* `String.t`, *default:* `nil`) - The number of bytes that were transformed. If transformation was unsuccessful or did not take place because there was no content to transform, this will be zero.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :containerName => String.t() | nil,
          :resourceName => String.t() | nil,
          :statusDetails =>
            GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationResultStatus.t() | nil,
          :transformation =>
            list(GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDescription.t()) | nil,
          :transformationLocation =>
            GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationLocation.t() | nil,
          :transformedBytes => String.t() | nil
        }

  field(:containerName)
  field(:resourceName)
  field(:statusDetails, as: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationResultStatus)

  field(:transformation,
    as: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDescription,
    type: :list
  )

  field(:transformationLocation,
    as: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationLocation
  )

  field(:transformedBytes)
end

defimpl Poison.Decoder, for: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDetails do
  def decode(value, options) do
    GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDetails.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2TransformationDetails do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
