# 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.DoubleClickBidManager.V2.Model.QuerySchedule do
  @moduledoc """
  Settings on when and how frequently to run a query.

  ## Attributes

  *   `endDate` (*type:* `GoogleApi.DoubleClickBidManager.V2.Model.Date.t`, *default:* `nil`) - The date on which to end the scheduled runs. This field is required if frequency is not set to `ONE_TIME`. Otherwise, it will be ignored.
  *   `frequency` (*type:* `String.t`, *default:* `nil`) - How frequently to run the query. If set to `ONE_TIME`, the query will only be run when queries.run is called.
  *   `nextRunTimezoneCode` (*type:* `String.t`, *default:* `nil`) - The canonical code for the timezone the query schedule is based on. Scheduled runs are usually conducted in the morning of a given day. Defaults to `America/New_York`.
  *   `startDate` (*type:* `GoogleApi.DoubleClickBidManager.V2.Model.Date.t`, *default:* `nil`) - The date on which to begin the scheduled runs. This field is required if frequency is not set to `ONE_TIME`. Otherwise, it will be ignored.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :endDate => GoogleApi.DoubleClickBidManager.V2.Model.Date.t() | nil,
          :frequency => String.t() | nil,
          :nextRunTimezoneCode => String.t() | nil,
          :startDate => GoogleApi.DoubleClickBidManager.V2.Model.Date.t() | nil
        }

  field(:endDate, as: GoogleApi.DoubleClickBidManager.V2.Model.Date)
  field(:frequency)
  field(:nextRunTimezoneCode)
  field(:startDate, as: GoogleApi.DoubleClickBidManager.V2.Model.Date)
end

defimpl Poison.Decoder, for: GoogleApi.DoubleClickBidManager.V2.Model.QuerySchedule do
  def decode(value, options) do
    GoogleApi.DoubleClickBidManager.V2.Model.QuerySchedule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DoubleClickBidManager.V2.Model.QuerySchedule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
