# 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.V1beta.Model.GoogleAnalyticsAdminV1betaKeyEvent do
  @moduledoc """
  A key event in a Google Analytics property.

  ## Attributes

  *   `countingMethod` (*type:* `String.t`, *default:* `nil`) - Required. The method by which Key Events will be counted across multiple events within a session.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when this key event was created in the property.
  *   `custom` (*type:* `boolean()`, *default:* `nil`) - Output only. If set to true, this key event refers to a custom event. If set to false, this key event refers to a default event in GA. Default events typically have special meaning in GA. Default events are usually created for you by the GA system, but in some cases can be created by property admins. Custom events count towards the maximum number of custom key events that may be created per property.
  *   `defaultValue` (*type:* `GoogleApi.AnalyticsAdmin.V1beta.Model.GoogleAnalyticsAdminV1betaKeyEventDefaultValue.t`, *default:* `nil`) - Optional. Defines a default value/currency for a key event.
  *   `deletable` (*type:* `boolean()`, *default:* `nil`) - Output only. If set to true, this event can be deleted.
  *   `eventName` (*type:* `String.t`, *default:* `nil`) - Immutable. The event name for this key event. Examples: 'click', 'purchase'
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name of this key event. Format: properties/{property}/keyEvents/{key_event}
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :countingMethod => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :custom => boolean() | nil,
          :defaultValue =>
            GoogleApi.AnalyticsAdmin.V1beta.Model.GoogleAnalyticsAdminV1betaKeyEventDefaultValue.t()
            | nil,
          :deletable => boolean() | nil,
          :eventName => String.t() | nil,
          :name => String.t() | nil
        }

  field(:countingMethod)
  field(:createTime, as: DateTime)
  field(:custom)

  field(:defaultValue,
    as: GoogleApi.AnalyticsAdmin.V1beta.Model.GoogleAnalyticsAdminV1betaKeyEventDefaultValue
  )

  field(:deletable)
  field(:eventName)
  field(:name)
end

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

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