# 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.CampaignBudget do
  @moduledoc """
  Settings that control how the campaign budget is allocated.

  ## Attributes

  *   `budgetAmountMicros` (*type:* `String.t`, *default:* `nil`) - Required. The total amount the linked insertion order segments can budget. The amount is in micros. Must be greater than 0. For example, 500000000 represents 500 standard units of the currency.
  *   `budgetId` (*type:* `String.t`, *default:* `nil`) - The unique ID of the campaign budget. Assigned by the system. Do not set for new budgets. Must be included when updating or adding budgets to campaign_budgets. Otherwise, a new ID will be generated and assigned.
  *   `budgetUnit` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. Specifies whether the budget is measured in currency or impressions.
  *   `dateRange` (*type:* `GoogleApi.DisplayVideo.V1.Model.DateRange.t`, *default:* `nil`) - Required. The date range for the campaign budget. Linked budget segments may have a different date range. They are resolved relative to the parent advertiser's time zone. Both `start_date` and `end_date` must be before the year 2037.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The display name of the budget. Must be UTF-8 encoded with a maximum size of 240 bytes.
  *   `externalBudgetId` (*type:* `String.t`, *default:* `nil`) - Immutable. The ID identifying this budget to the external source. If this field is set and the invoice detail level of the corresponding billing profile is set to "Budget level PO", all impressions served against this budget will include this ID on the invoice. Must be unique under the campaign.
  *   `externalBudgetSource` (*type:* `String.t`, *default:* `nil`) - Required. The external source of the budget.
  *   `invoiceGroupingId` (*type:* `String.t`, *default:* `nil`) - Immutable. The ID used to group budgets to be included the same invoice. If this field is set and the invoice level of the corresponding billing profile is set to "Budget invoice grouping ID", all external_budget_id sharing the same invoice_grouping_id will be grouped in the same invoice.
  *   `prismaConfig` (*type:* `GoogleApi.DisplayVideo.V1.Model.PrismaConfig.t`, *default:* `nil`) - Additional metadata for use by the Mediaocean Prisma tool. Required for Mediaocean budgets. Only applicable to prisma_enabled advertisers.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :budgetAmountMicros => String.t() | nil,
          :budgetId => String.t() | nil,
          :budgetUnit => String.t() | nil,
          :dateRange => GoogleApi.DisplayVideo.V1.Model.DateRange.t() | nil,
          :displayName => String.t() | nil,
          :externalBudgetId => String.t() | nil,
          :externalBudgetSource => String.t() | nil,
          :invoiceGroupingId => String.t() | nil,
          :prismaConfig => GoogleApi.DisplayVideo.V1.Model.PrismaConfig.t() | nil
        }

  field(:budgetAmountMicros)
  field(:budgetId)
  field(:budgetUnit)
  field(:dateRange, as: GoogleApi.DisplayVideo.V1.Model.DateRange)
  field(:displayName)
  field(:externalBudgetId)
  field(:externalBudgetSource)
  field(:invoiceGroupingId)
  field(:prismaConfig, as: GoogleApi.DisplayVideo.V1.Model.PrismaConfig)
end

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

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