# 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.AnalyticsReporting.V4.Model.EcommerceData do
  @moduledoc """
  E-commerce details associated with the user activity.

  ## Attributes

  *   `actionType` (*type:* `String.t`, *default:* `nil`) - Action associated with this e-commerce action.
  *   `ecommerceType` (*type:* `String.t`, *default:* `nil`) - The type of this e-commerce activity.
  *   `products` (*type:* `list(GoogleApi.AnalyticsReporting.V4.Model.ProductData.t)`, *default:* `nil`) - Details of the products in this transaction.
  *   `transaction` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.TransactionData.t`, *default:* `nil`) - Transaction details of this e-commerce action.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :actionType => String.t() | nil,
          :ecommerceType => String.t() | nil,
          :products => list(GoogleApi.AnalyticsReporting.V4.Model.ProductData.t()) | nil,
          :transaction => GoogleApi.AnalyticsReporting.V4.Model.TransactionData.t() | nil
        }

  field(:actionType)
  field(:ecommerceType)
  field(:products, as: GoogleApi.AnalyticsReporting.V4.Model.ProductData, type: :list)
  field(:transaction, as: GoogleApi.AnalyticsReporting.V4.Model.TransactionData)
end

defimpl Poison.Decoder, for: GoogleApi.AnalyticsReporting.V4.Model.EcommerceData do
  def decode(value, options) do
    GoogleApi.AnalyticsReporting.V4.Model.EcommerceData.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AnalyticsReporting.V4.Model.EcommerceData do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
