# 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.V1.Model.GuaranteedOrder do
  @moduledoc """
  A guaranteed order. Guaranteed orders are parent entity of guaranteed inventory sources. When creating a guaranteed inventory source, a guaranteed order ID must be assigned to the inventory source.

  ## Attributes

  *   `defaultAdvertiserId` (*type:* `String.t`, *default:* `nil`) - Output only. The ID of default advertiser of the guaranteed order. The default advertiser is either the read_write_advertiser_id or, if that is not set, the first advertiser listed in read_advertiser_ids. Otherwise, there is no default advertiser.
  *   `defaultCampaignId` (*type:* `String.t`, *default:* `nil`) - The ID of the default campaign that is assigned to the guaranteed order. The default campaign must belong to the default advertiser.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The display name of the guaranteed order. Must be UTF-8 encoded with a maximum size of 240 bytes.
  *   `exchange` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The exchange where the guaranteed order originated.
  *   `guaranteedOrderId` (*type:* `String.t`, *default:* `nil`) - Output only. The unique identifier of the guaranteed order. The guaranteed order IDs have the format `{exchange}-{legacy_guaranteed_order_id}`.
  *   `legacyGuaranteedOrderId` (*type:* `String.t`, *default:* `nil`) - Output only. The legacy ID of the guaranteed order. Assigned by the original exchange. The legacy ID is unique within one exchange, but is not guaranteed to be unique across all guaranteed orders. This ID is used in SDF and UI.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name of the guaranteed order.
  *   `publisherName` (*type:* `String.t`, *default:* `nil`) - Required. The publisher name of the guaranteed order. Must be UTF-8 encoded with a maximum size of 240 bytes.
  *   `readAccessInherited` (*type:* `boolean()`, *default:* `nil`) - Whether all advertisers of read_write_partner_id have read access to the guaranteed order. Only applicable if read_write_partner_id is set. If True, overrides read_advertiser_ids.
  *   `readAdvertiserIds` (*type:* `list(String.t)`, *default:* `nil`) - The IDs of advertisers with read access to the guaranteed order. This field must not include the advertiser assigned to read_write_advertiser_id if it is set. All advertisers in this field must belong to read_write_partner_id or the same partner as read_write_advertiser_id.
  *   `readWriteAdvertiserId` (*type:* `String.t`, *default:* `nil`) - The advertiser with read/write access to the guaranteed order. This is also the default advertiser of the guaranteed order.
  *   `readWritePartnerId` (*type:* `String.t`, *default:* `nil`) - The partner with read/write access to the guaranteed order.
  *   `status` (*type:* `GoogleApi.DisplayVideo.V1.Model.GuaranteedOrderStatus.t`, *default:* `nil`) - The status settings of the guaranteed order.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when the guaranteed order was last updated. Assigned by the system.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :defaultAdvertiserId => String.t() | nil,
          :defaultCampaignId => String.t() | nil,
          :displayName => String.t() | nil,
          :exchange => String.t() | nil,
          :guaranteedOrderId => String.t() | nil,
          :legacyGuaranteedOrderId => String.t() | nil,
          :name => String.t() | nil,
          :publisherName => String.t() | nil,
          :readAccessInherited => boolean() | nil,
          :readAdvertiserIds => list(String.t()) | nil,
          :readWriteAdvertiserId => String.t() | nil,
          :readWritePartnerId => String.t() | nil,
          :status => GoogleApi.DisplayVideo.V1.Model.GuaranteedOrderStatus.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:defaultAdvertiserId)
  field(:defaultCampaignId)
  field(:displayName)
  field(:exchange)
  field(:guaranteedOrderId)
  field(:legacyGuaranteedOrderId)
  field(:name)
  field(:publisherName)
  field(:readAccessInherited)
  field(:readAdvertiserIds, type: :list)
  field(:readWriteAdvertiserId)
  field(:readWritePartnerId)
  field(:status, as: GoogleApi.DisplayVideo.V1.Model.GuaranteedOrderStatus)
  field(:updateTime, as: DateTime)
end

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

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