# 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.V2beta1.Model.Proposal do
  @moduledoc """
  Represents a proposal in the Marketplace. A proposal is the unit of negotiation between a seller and a buyer and contains deals which are served. Note: You can't update, create, or otherwise modify Private Auction deals through the API. Fields are updatable unless noted otherwise.

  ## Attributes

  *   `billedBuyer` (*type:* `GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer.t`, *default:* `nil`) - Output only. Reference to the buyer that will get billed for this proposal.
  *   `buyer` (*type:* `GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer.t`, *default:* `nil`) - Reference to the buyer on the proposal. Note: This field may be set only when creating the resource. Modifying this field while updating the resource will result in an error.
  *   `buyerContacts` (*type:* `list(GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation.t)`, *default:* `nil`) - Contact information for the buyer.
  *   `buyerPrivateData` (*type:* `GoogleApi.AdExchangeBuyer.V2beta1.Model.PrivateData.t`, *default:* `nil`) - Private data for buyer. (hidden from seller).
  *   `deals` (*type:* `list(GoogleApi.AdExchangeBuyer.V2beta1.Model.Deal.t)`, *default:* `nil`) - The deals associated with this proposal. For Private Auction proposals (whose deals have NonGuaranteedAuctionTerms), there will only be one deal.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The name for the proposal.
  *   `isRenegotiating` (*type:* `boolean()`, *default:* `nil`) - Output only. True if the proposal is being renegotiated.
  *   `isSetupComplete` (*type:* `boolean()`, *default:* `nil`) - Output only. True, if the buyside inventory setup is complete for this proposal.
  *   `lastUpdaterOrCommentorRole` (*type:* `String.t`, *default:* `nil`) - Output only. The role of the last user that either updated the proposal or left a comment.
  *   `notes` (*type:* `list(GoogleApi.AdExchangeBuyer.V2beta1.Model.Note.t)`, *default:* `nil`) - Output only. The notes associated with this proposal.
  *   `originatorRole` (*type:* `String.t`, *default:* `nil`) - Output only. Indicates whether the buyer/seller created the proposal.
  *   `privateAuctionId` (*type:* `String.t`, *default:* `nil`) - Output only. Private auction ID if this proposal is a private auction proposal.
  *   `proposalId` (*type:* `String.t`, *default:* `nil`) - Output only. The unique ID of the proposal.
  *   `proposalRevision` (*type:* `String.t`, *default:* `nil`) - Output only. The revision number for the proposal. Each update to the proposal or the deal causes the proposal revision number to auto-increment. The buyer keeps track of the last revision number they know of and pass it in when making an update. If the head revision number on the server has since incremented, then an ABORTED error is returned during the update operation to let the buyer know that a subsequent update was made.
  *   `proposalState` (*type:* `String.t`, *default:* `nil`) - Output only. The current state of the proposal.
  *   `seller` (*type:* `GoogleApi.AdExchangeBuyer.V2beta1.Model.Seller.t`, *default:* `nil`) - Reference to the seller on the proposal. Note: This field may be set only when creating the resource. Modifying this field while updating the resource will result in an error.
  *   `sellerContacts` (*type:* `list(GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation.t)`, *default:* `nil`) - Output only. Contact information for the seller.
  *   `termsAndConditions` (*type:* `String.t`, *default:* `nil`) - Output only. The terms and conditions set by the publisher for this proposal.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the proposal was last revised.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :billedBuyer => GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer.t() | nil,
          :buyer => GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer.t() | nil,
          :buyerContacts =>
            list(GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation.t()) | nil,
          :buyerPrivateData => GoogleApi.AdExchangeBuyer.V2beta1.Model.PrivateData.t() | nil,
          :deals => list(GoogleApi.AdExchangeBuyer.V2beta1.Model.Deal.t()) | nil,
          :displayName => String.t() | nil,
          :isRenegotiating => boolean() | nil,
          :isSetupComplete => boolean() | nil,
          :lastUpdaterOrCommentorRole => String.t() | nil,
          :notes => list(GoogleApi.AdExchangeBuyer.V2beta1.Model.Note.t()) | nil,
          :originatorRole => String.t() | nil,
          :privateAuctionId => String.t() | nil,
          :proposalId => String.t() | nil,
          :proposalRevision => String.t() | nil,
          :proposalState => String.t() | nil,
          :seller => GoogleApi.AdExchangeBuyer.V2beta1.Model.Seller.t() | nil,
          :sellerContacts =>
            list(GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation.t()) | nil,
          :termsAndConditions => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:billedBuyer, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer)
  field(:buyer, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.Buyer)

  field(:buyerContacts,
    as: GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation,
    type: :list
  )

  field(:buyerPrivateData, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.PrivateData)
  field(:deals, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.Deal, type: :list)
  field(:displayName)
  field(:isRenegotiating)
  field(:isSetupComplete)
  field(:lastUpdaterOrCommentorRole)
  field(:notes, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.Note, type: :list)
  field(:originatorRole)
  field(:privateAuctionId)
  field(:proposalId)
  field(:proposalRevision)
  field(:proposalState)
  field(:seller, as: GoogleApi.AdExchangeBuyer.V2beta1.Model.Seller)

  field(:sellerContacts,
    as: GoogleApi.AdExchangeBuyer.V2beta1.Model.ContactInformation,
    type: :list
  )

  field(:termsAndConditions)
  field(:updateTime, as: DateTime)
end

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

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