# 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.CloudBilling.V1.Model.PricingInfo do
  @moduledoc """
  Represents the pricing information for a SKU at a single point of time.

  ## Attributes

  *   `aggregationInfo` (*type:* `GoogleApi.CloudBilling.V1.Model.AggregationInfo.t`, *default:* `nil`) - Aggregation Info. This can be left unspecified if the pricing expression doesn't require aggregation.
  *   `currencyConversionRate` (*type:* `float()`, *default:* `nil`) - Conversion rate used for currency conversion, from USD to the currency specified in the request. This includes any surcharge collected for billing in non USD currency. If a currency is not specified in the request this defaults to 1.0. Example: USD * currency_conversion_rate = JPY
  *   `effectiveTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp from which this pricing was effective within the requested time range. This is guaranteed to be greater than or equal to the start_time field in the request and less than the end_time field in the request. If a time range was not specified in the request this field will be equivalent to a time within the last 12 hours, indicating the latest pricing info.
  *   `pricingExpression` (*type:* `GoogleApi.CloudBilling.V1.Model.PricingExpression.t`, *default:* `nil`) - Expresses the pricing formula. See `PricingExpression` for an example.
  *   `summary` (*type:* `String.t`, *default:* `nil`) - An optional human readable summary of the pricing information, has a maximum length of 256 characters.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :aggregationInfo => GoogleApi.CloudBilling.V1.Model.AggregationInfo.t() | nil,
          :currencyConversionRate => float() | nil,
          :effectiveTime => DateTime.t() | nil,
          :pricingExpression => GoogleApi.CloudBilling.V1.Model.PricingExpression.t() | nil,
          :summary => String.t() | nil
        }

  field(:aggregationInfo, as: GoogleApi.CloudBilling.V1.Model.AggregationInfo)
  field(:currencyConversionRate)
  field(:effectiveTime, as: DateTime)
  field(:pricingExpression, as: GoogleApi.CloudBilling.V1.Model.PricingExpression)
  field(:summary)
end

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

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