# 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.Places.V1.Model.GoogleMapsPlacesV1PlaceOpeningHoursPeriodPoint do
  @moduledoc """
  Status changing points.

  ## Attributes

  *   `date` (*type:* `GoogleApi.Places.V1.Model.GoogleTypeDate.t`, *default:* `nil`) - Date in the local timezone for the place.
  *   `day` (*type:* `integer()`, *default:* `nil`) - A day of the week, as an integer in the range 0-6. 0 is Sunday, 1 is Monday, etc.
  *   `hour` (*type:* `integer()`, *default:* `nil`) - The hour in 24 hour format. Ranges from 0 to 23.
  *   `minute` (*type:* `integer()`, *default:* `nil`) - The minute. Ranges from 0 to 59.
  *   `truncated` (*type:* `boolean()`, *default:* `nil`) - Whether or not this endpoint was truncated. Truncation occurs when the real hours are outside the times we are willing to return hours between, so we truncate the hours back to these boundaries. This ensures that at most 24 * 7 hours from midnight of the day of the request are returned.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :date => GoogleApi.Places.V1.Model.GoogleTypeDate.t() | nil,
          :day => integer() | nil,
          :hour => integer() | nil,
          :minute => integer() | nil,
          :truncated => boolean() | nil
        }

  field(:date, as: GoogleApi.Places.V1.Model.GoogleTypeDate)
  field(:day)
  field(:hour)
  field(:minute)
  field(:truncated)
end

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

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