# 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.DisplayVideo.V1.Model.ConversionCountingConfig do
  @moduledoc """
  Settings that control how conversions are counted. All post-click conversions will be counted. A percentage value can be set for post-view conversions counting.

  ## Attributes

  *   `floodlightActivityConfigs` (*type:* `list(GoogleApi.DisplayVideo.V1.Model.TrackingFloodlightActivityConfig.t)`, *default:* `nil`) - The Floodlight activity configs used to track conversions. The number of conversions counted is the sum of all of the conversions counted by all of the Floodlight activity IDs specified in this field.
  *   `postViewCountPercentageMillis` (*type:* `String.t`, *default:* `nil`) - The percentage of post-view conversions to count, in millis (1/1000 of a percent). Must be between 0 and 100000 inclusive. For example, to track 50% of the post-click conversions, set a value of 50000.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :floodlightActivityConfigs =>
            list(GoogleApi.DisplayVideo.V1.Model.TrackingFloodlightActivityConfig.t()) | nil,
          :postViewCountPercentageMillis => String.t() | nil
        }

  field(:floodlightActivityConfigs,
    as: GoogleApi.DisplayVideo.V1.Model.TrackingFloodlightActivityConfig,
    type: :list
  )

  field(:postViewCountPercentageMillis)
end

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

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