# 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.V3.Model.RateDetails do
  @moduledoc """
  The rate related settings of the inventory source.

  ## Attributes

  *   `inventorySourceRateType` (*type:* `String.t`, *default:* `nil`) - The rate type. Acceptable values are `INVENTORY_SOURCE_RATE_TYPE_CPM_FIXED`, `INVENTORY_SOURCE_RATE_TYPE_CPM_FLOOR`, and `INVENTORY_SOURCE_RATE_TYPE_CPD`.
  *   `minimumSpend` (*type:* `GoogleApi.DisplayVideo.V3.Model.Money.t`, *default:* `nil`) - Output only. The amount that the buyer has committed to spending on the inventory source up front. Only applicable for guaranteed inventory sources.
  *   `rate` (*type:* `GoogleApi.DisplayVideo.V3.Model.Money.t`, *default:* `nil`) - The rate for the inventory source.
  *   `unitsPurchased` (*type:* `String.t`, *default:* `nil`) - Required for guaranteed inventory sources. The number of impressions guaranteed by the seller.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :inventorySourceRateType => String.t() | nil,
          :minimumSpend => GoogleApi.DisplayVideo.V3.Model.Money.t() | nil,
          :rate => GoogleApi.DisplayVideo.V3.Model.Money.t() | nil,
          :unitsPurchased => String.t() | nil
        }

  field(:inventorySourceRateType)
  field(:minimumSpend, as: GoogleApi.DisplayVideo.V3.Model.Money)
  field(:rate, as: GoogleApi.DisplayVideo.V3.Model.Money)
  field(:unitsPurchased)
end

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

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