lib/google_api/content/v21/model/order_promotion.ex

# 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.Content.V21.Model.OrderPromotion do
  @moduledoc """


  ## Attributes

  *   `applicableItems` (*type:* `list(GoogleApi.Content.V21.Model.OrderPromotionItem.t)`, *default:* `nil`) - Items that this promotion may be applied to. If empty, there are no restrictions on applicable items and quantity. This field will also be empty for shipping promotions because shipping is not tied to any specific item.
  *   `appliedItems` (*type:* `list(GoogleApi.Content.V21.Model.OrderPromotionItem.t)`, *default:* `nil`) - Items that this promotion have been applied to. Do not provide for `orders.createtestorder`. This field will be empty for shipping promotions because shipping is not tied to any specific item.
  *   `endTime` (*type:* `String.t`, *default:* `nil`) - Promotion end time in ISO 8601 format. Date, time, and offset required, e.g., "2020-01-02T09:00:00+01:00" or "2020-01-02T09:00:00Z".
  *   `funder` (*type:* `String.t`, *default:* `nil`) - Required. The party funding the promotion. Only `merchant` is supported for `orders.createtestorder`. Acceptable values are: - "`google`" - "`merchant`" 
  *   `merchantPromotionId` (*type:* `String.t`, *default:* `nil`) - Required. This field is used to identify promotions within merchants' own systems.
  *   `priceValue` (*type:* `GoogleApi.Content.V21.Model.Price.t`, *default:* `nil`) - Estimated discount applied to price. Amount is pre-tax or post-tax depending on location of order.
  *   `shortTitle` (*type:* `String.t`, *default:* `nil`) - A short title of the promotion to be shown on the checkout page. Do not provide for `orders.createtestorder`.
  *   `startTime` (*type:* `String.t`, *default:* `nil`) - Promotion start time in ISO 8601 format. Date, time, and offset required, e.g., "2020-01-02T09:00:00+01:00" or "2020-01-02T09:00:00Z".
  *   `subtype` (*type:* `String.t`, *default:* `nil`) - Required. The category of the promotion. Only `moneyOff` is supported for `orders.createtestorder`. Acceptable values are: - "`buyMGetMoneyOff`" - "`buyMGetNMoneyOff`" - "`buyMGetNPercentOff`" - "`buyMGetPercentOff`" - "`freeGift`" - "`freeGiftWithItemId`" - "`freeGiftWithValue`" - "`freeShippingOvernight`" - "`freeShippingStandard`" - "`freeShippingTwoDay`" - "`moneyOff`" - "`percentOff`" - "`rewardPoints`" - "`salePrice`" 
  *   `taxValue` (*type:* `GoogleApi.Content.V21.Model.Price.t`, *default:* `nil`) - Estimated discount applied to tax (if allowed by law). Do not provide for `orders.createtestorder`.
  *   `title` (*type:* `String.t`, *default:* `nil`) - Required. The title of the promotion.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Required. The scope of the promotion. Only `product` is supported for `orders.createtestorder`. Acceptable values are: - "`product`" - "`shipping`" 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :applicableItems => list(GoogleApi.Content.V21.Model.OrderPromotionItem.t()) | nil,
          :appliedItems => list(GoogleApi.Content.V21.Model.OrderPromotionItem.t()) | nil,
          :endTime => String.t() | nil,
          :funder => String.t() | nil,
          :merchantPromotionId => String.t() | nil,
          :priceValue => GoogleApi.Content.V21.Model.Price.t() | nil,
          :shortTitle => String.t() | nil,
          :startTime => String.t() | nil,
          :subtype => String.t() | nil,
          :taxValue => GoogleApi.Content.V21.Model.Price.t() | nil,
          :title => String.t() | nil,
          :type => String.t() | nil
        }

  field(:applicableItems, as: GoogleApi.Content.V21.Model.OrderPromotionItem, type: :list)
  field(:appliedItems, as: GoogleApi.Content.V21.Model.OrderPromotionItem, type: :list)
  field(:endTime)
  field(:funder)
  field(:merchantPromotionId)
  field(:priceValue, as: GoogleApi.Content.V21.Model.Price)
  field(:shortTitle)
  field(:startTime)
  field(:subtype)
  field(:taxValue, as: GoogleApi.Content.V21.Model.Price)
  field(:title)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.Content.V21.Model.OrderPromotion do
  def decode(value, options) do
    GoogleApi.Content.V21.Model.OrderPromotion.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V21.Model.OrderPromotion do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end