# 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.GKEBackup.V1.Model.ExclusionWindow do
  @moduledoc """
  Defines a time window during which no backup should happen. All time and date are in UTC.

  ## Attributes

  *   `daily` (*type:* `boolean()`, *default:* `nil`) - The exclusion window occurs every day if set to "True". Specifying this field to "False" is an error.
  *   `daysOfWeek` (*type:* `GoogleApi.GKEBackup.V1.Model.DayOfWeekList.t`, *default:* `nil`) - The exclusion window occurs on these days of each week in UTC.
  *   `duration` (*type:* `String.t`, *default:* `nil`) - Required. Specifies duration of the window. Duration must be >= 5 minutes and < (target RPO - 20 minutes). Additional restrictions based on the recurrence type to allow some time for backup to happen: - single_occurrence_date: no restriction, but UI may warn about this when duration >= target RPO - daily window: duration < 24 hours - weekly window: - days of week includes all seven days of a week: duration < 24 hours - all other weekly window: duration < 168 hours (i.e., 24 * 7 hours)
  *   `singleOccurrenceDate` (*type:* `GoogleApi.GKEBackup.V1.Model.Date.t`, *default:* `nil`) - No recurrence. The exclusion window occurs only once and on this date in UTC.
  *   `startTime` (*type:* `GoogleApi.GKEBackup.V1.Model.TimeOfDay.t`, *default:* `nil`) - Required. Specifies the start time of the window using time of the day in UTC.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :daily => boolean() | nil,
          :daysOfWeek => GoogleApi.GKEBackup.V1.Model.DayOfWeekList.t() | nil,
          :duration => String.t() | nil,
          :singleOccurrenceDate => GoogleApi.GKEBackup.V1.Model.Date.t() | nil,
          :startTime => GoogleApi.GKEBackup.V1.Model.TimeOfDay.t() | nil
        }

  field(:daily)
  field(:daysOfWeek, as: GoogleApi.GKEBackup.V1.Model.DayOfWeekList)
  field(:duration)
  field(:singleOccurrenceDate, as: GoogleApi.GKEBackup.V1.Model.Date)
  field(:startTime, as: GoogleApi.GKEBackup.V1.Model.TimeOfDay)
end

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

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