# 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.AdExchangeBuyer.V14.Model.Product do
  @moduledoc """
  A product is segment of inventory that a seller wishes to sell. It is associated with certain terms and targeting information which helps buyer know more about the inventory. Each field in a product can have one of the following setting:

  (readonly) - It is an error to try and set this field. (buyer-readonly) - Only the seller can set this field. (seller-readonly) - Only the buyer can set this field. (updatable) - The field is updatable at all times by either buyer or the seller.

  ## Attributes

  *   `billedBuyer` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.Buyer.t`, *default:* `nil`) - The billed buyer corresponding to the buyer that created the offer. (readonly, except on create)
  *   `buyer` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.Buyer.t`, *default:* `nil`) - The buyer that created the offer if this is a buyer initiated offer (readonly, except on create)
  *   `creationTimeMs` (*type:* `String.t`, *default:* `nil`) - Creation time in ms. since epoch (readonly)
  *   `creatorContacts` (*type:* `list(GoogleApi.AdExchangeBuyer.V14.Model.ContactInformation.t)`, *default:* `nil`) - Optional contact information for the creator of this product. (buyer-readonly)
  *   `creatorRole` (*type:* `String.t`, *default:* `nil`) - The role that created the offer. Set to BUYER for buyer initiated offers.
  *   `deliveryControl` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.DeliveryControl.t`, *default:* `nil`) - The set of fields around delivery control that are interesting for a buyer to see but are non-negotiable. These are set by the publisher. This message is assigned an id of 100 since some day we would want to model this as a protobuf extension.
  *   `flightEndTimeMs` (*type:* `String.t`, *default:* `nil`) - The proposed end time for the deal (ms since epoch) (buyer-readonly)
  *   `flightStartTimeMs` (*type:* `String.t`, *default:* `nil`) - Inventory availability dates. (times are in ms since epoch) The granularity is generally in the order of seconds. (buyer-readonly)
  *   `hasCreatorSignedOff` (*type:* `boolean()`, *default:* `nil`) - If the creator has already signed off on the product, then the buyer can finalize the deal by accepting the product as is. When copying to a proposal, if any of the terms are changed, then auto_finalize is automatically set to false.
  *   `inventorySource` (*type:* `String.t`, *default:* `nil`) - What exchange will provide this inventory (readonly, except on create).
  *   `kind` (*type:* `String.t`, *default:* `adexchangebuyer#product`) - Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#product".
  *   `labels` (*type:* `list(GoogleApi.AdExchangeBuyer.V14.Model.MarketplaceLabel.t)`, *default:* `nil`) - Optional List of labels for the product (optional, buyer-readonly).
  *   `lastUpdateTimeMs` (*type:* `String.t`, *default:* `nil`) - Time of last update in ms. since epoch (readonly)
  *   `legacyOfferId` (*type:* `String.t`, *default:* `nil`) - Optional legacy offer id if this offer is a preferred deal offer.
  *   `marketplacePublisherProfileId` (*type:* `String.t`, *default:* `nil`) - Marketplace publisher profile Id. This Id differs from the regular publisher_profile_id in that 1. This is a new id, the old Id will be deprecated in 2017. 2. This id uniquely identifies a publisher profile by itself.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name for this product as set by the seller. (buyer-readonly)
  *   `privateAuctionId` (*type:* `String.t`, *default:* `nil`) - Optional private auction id if this offer is a private auction offer.
  *   `productId` (*type:* `String.t`, *default:* `nil`) - The unique id for the product (readonly)
  *   `publisherProfileId` (*type:* `String.t`, *default:* `nil`) - Id of the publisher profile for a given seller. A (seller.account_id, publisher_profile_id) pair uniquely identifies a publisher profile. Buyers can call the PublisherProfiles::List endpoint to get a list of publisher profiles for a given seller.
  *   `publisherProvidedForecast` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.PublisherProvidedForecast.t`, *default:* `nil`) - Publisher self-provided forecast information.
  *   `revisionNumber` (*type:* `String.t`, *default:* `nil`) - The revision number of the product. (readonly)
  *   `seller` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.Seller.t`, *default:* `nil`) - Information about the seller that created this product (readonly, except on create)
  *   `sharedTargetings` (*type:* `list(GoogleApi.AdExchangeBuyer.V14.Model.SharedTargeting.t)`, *default:* `nil`) - Targeting that is shared between the buyer and the seller. Each targeting criteria has a specified key and for each key there is a list of inclusion value or exclusion values. (buyer-readonly)
  *   `state` (*type:* `String.t`, *default:* `nil`) - The state of the product. (buyer-readonly)
  *   `syndicationProduct` (*type:* `String.t`, *default:* `nil`) - The syndication product associated with the deal. (readonly, except on create)
  *   `terms` (*type:* `GoogleApi.AdExchangeBuyer.V14.Model.DealTerms.t`, *default:* `nil`) - The negotiable terms of the deal (buyer-readonly)
  *   `webPropertyCode` (*type:* `String.t`, *default:* `nil`) - The web property code for the seller. This field is meant to be copied over as is when creating deals.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :billedBuyer => GoogleApi.AdExchangeBuyer.V14.Model.Buyer.t() | nil,
          :buyer => GoogleApi.AdExchangeBuyer.V14.Model.Buyer.t() | nil,
          :creationTimeMs => String.t() | nil,
          :creatorContacts =>
            list(GoogleApi.AdExchangeBuyer.V14.Model.ContactInformation.t()) | nil,
          :creatorRole => String.t() | nil,
          :deliveryControl => GoogleApi.AdExchangeBuyer.V14.Model.DeliveryControl.t() | nil,
          :flightEndTimeMs => String.t() | nil,
          :flightStartTimeMs => String.t() | nil,
          :hasCreatorSignedOff => boolean() | nil,
          :inventorySource => String.t() | nil,
          :kind => String.t() | nil,
          :labels => list(GoogleApi.AdExchangeBuyer.V14.Model.MarketplaceLabel.t()) | nil,
          :lastUpdateTimeMs => String.t() | nil,
          :legacyOfferId => String.t() | nil,
          :marketplacePublisherProfileId => String.t() | nil,
          :name => String.t() | nil,
          :privateAuctionId => String.t() | nil,
          :productId => String.t() | nil,
          :publisherProfileId => String.t() | nil,
          :publisherProvidedForecast =>
            GoogleApi.AdExchangeBuyer.V14.Model.PublisherProvidedForecast.t() | nil,
          :revisionNumber => String.t() | nil,
          :seller => GoogleApi.AdExchangeBuyer.V14.Model.Seller.t() | nil,
          :sharedTargetings =>
            list(GoogleApi.AdExchangeBuyer.V14.Model.SharedTargeting.t()) | nil,
          :state => String.t() | nil,
          :syndicationProduct => String.t() | nil,
          :terms => GoogleApi.AdExchangeBuyer.V14.Model.DealTerms.t() | nil,
          :webPropertyCode => String.t() | nil
        }

  field(:billedBuyer, as: GoogleApi.AdExchangeBuyer.V14.Model.Buyer)
  field(:buyer, as: GoogleApi.AdExchangeBuyer.V14.Model.Buyer)
  field(:creationTimeMs)
  field(:creatorContacts, as: GoogleApi.AdExchangeBuyer.V14.Model.ContactInformation, type: :list)
  field(:creatorRole)
  field(:deliveryControl, as: GoogleApi.AdExchangeBuyer.V14.Model.DeliveryControl)
  field(:flightEndTimeMs)
  field(:flightStartTimeMs)
  field(:hasCreatorSignedOff)
  field(:inventorySource)
  field(:kind)
  field(:labels, as: GoogleApi.AdExchangeBuyer.V14.Model.MarketplaceLabel, type: :list)
  field(:lastUpdateTimeMs)
  field(:legacyOfferId)
  field(:marketplacePublisherProfileId)
  field(:name)
  field(:privateAuctionId)
  field(:productId)
  field(:publisherProfileId)

  field(:publisherProvidedForecast,
    as: GoogleApi.AdExchangeBuyer.V14.Model.PublisherProvidedForecast
  )

  field(:revisionNumber)
  field(:seller, as: GoogleApi.AdExchangeBuyer.V14.Model.Seller)
  field(:sharedTargetings, as: GoogleApi.AdExchangeBuyer.V14.Model.SharedTargeting, type: :list)
  field(:state)
  field(:syndicationProduct)
  field(:terms, as: GoogleApi.AdExchangeBuyer.V14.Model.DealTerms)
  field(:webPropertyCode)
end

defimpl Poison.Decoder, for: GoogleApi.AdExchangeBuyer.V14.Model.Product do
  def decode(value, options) do
    GoogleApi.AdExchangeBuyer.V14.Model.Product.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AdExchangeBuyer.V14.Model.Product do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
