# 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.V3.Model.MastheadAd do
  @moduledoc """
  Details for a Masthead Ad.

  ## Attributes

  *   `autoplayVideoDuration` (*type:* `String.t`, *default:* `nil`) - The duration of time the video will autoplay.
  *   `autoplayVideoStartMillisecond` (*type:* `String.t`, *default:* `nil`) - The amount of time in milliseconds after which the video will start to play.
  *   `callToActionButtonLabel` (*type:* `String.t`, *default:* `nil`) - The text on the call-to-action button.
  *   `callToActionFinalUrl` (*type:* `String.t`, *default:* `nil`) - The destination URL for the call-to-action button.
  *   `callToActionTrackingUrl` (*type:* `String.t`, *default:* `nil`) - The tracking URL for the call-to-action button.
  *   `companionYoutubeVideos` (*type:* `list(GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails.t)`, *default:* `nil`) - The videos that appear next to the Masthead Ad on desktop. Can be no more than two.
  *   `description` (*type:* `String.t`, *default:* `nil`) - The description of the ad.
  *   `headline` (*type:* `String.t`, *default:* `nil`) - The headline of the ad.
  *   `showChannelArt` (*type:* `boolean()`, *default:* `nil`) - Whether to show a background or banner that appears at the top of a YouTube page.
  *   `video` (*type:* `GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails.t`, *default:* `nil`) - The YouTube video used by the ad.
  *   `videoAspectRatio` (*type:* `String.t`, *default:* `nil`) - The aspect ratio of the autoplaying YouTube video on the Masthead.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :autoplayVideoDuration => String.t() | nil,
          :autoplayVideoStartMillisecond => String.t() | nil,
          :callToActionButtonLabel => String.t() | nil,
          :callToActionFinalUrl => String.t() | nil,
          :callToActionTrackingUrl => String.t() | nil,
          :companionYoutubeVideos =>
            list(GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails.t()) | nil,
          :description => String.t() | nil,
          :headline => String.t() | nil,
          :showChannelArt => boolean() | nil,
          :video => GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails.t() | nil,
          :videoAspectRatio => String.t() | nil
        }

  field(:autoplayVideoDuration)
  field(:autoplayVideoStartMillisecond)
  field(:callToActionButtonLabel)
  field(:callToActionFinalUrl)
  field(:callToActionTrackingUrl)

  field(:companionYoutubeVideos,
    as: GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails,
    type: :list
  )

  field(:description)
  field(:headline)
  field(:showChannelArt)
  field(:video, as: GoogleApi.DisplayVideo.V3.Model.YoutubeVideoDetails)
  field(:videoAspectRatio)
end

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

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