# 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.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaEventMapping do
  @moduledoc """
  Event setting conditions to match an event.

  ## Attributes

  *   `eventName` (*type:* `String.t`, *default:* `nil`) - Required. Name of the Google Analytics event. It must always be set. The max allowed display name length is 40 UTF-16 code units.
  *   `maxEventCount` (*type:* `String.t`, *default:* `nil`) - The maximum number of times the event occurred. If not set, maximum event count won't be checked.
  *   `maxEventValue` (*type:* `float()`, *default:* `nil`) - The maximum revenue generated due to the event. Revenue currency will be defined at the property level. If not set, maximum event value won't be checked.
  *   `minEventCount` (*type:* `String.t`, *default:* `nil`) - At least one of the following four min/max values must be set. The values set will be ANDed together to qualify an event. The minimum number of times the event occurred. If not set, minimum event count won't be checked.
  *   `minEventValue` (*type:* `float()`, *default:* `nil`) - The minimum revenue generated due to the event. Revenue currency will be defined at the property level. If not set, minimum event value won't be checked.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :eventName => String.t() | nil,
          :maxEventCount => String.t() | nil,
          :maxEventValue => float() | nil,
          :minEventCount => String.t() | nil,
          :minEventValue => float() | nil
        }

  field(:eventName)
  field(:maxEventCount)
  field(:maxEventValue)
  field(:minEventCount)
  field(:minEventValue)
end

defimpl Poison.Decoder,
  for: GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaEventMapping do
  def decode(value, options) do
    GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaEventMapping.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaEventMapping do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
