# 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.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest do
  @moduledoc """
   Life of a query: - When a game starts in a new location, your game server issues a SamplePlayableLocations request. The request specifies the S2 cell, and contains one or more "criteria" for filtering: - Criterion 0: i locations for long-lived bases, or level 0 monsters, or... - Criterion 1: j locations for short-lived bases, or level 1 monsters, ... - Criterion 2: k locations for random objects. - etc (up to 5 criterion may be specified). `PlayableLocationList` will then contain mutually exclusive lists of `PlayableLocation` objects that satisfy each of the criteria. Think of it as a collection of real-world locations that you can then associate with your game state. Note: These points are impermanent in nature. E.g, parks can close, and places can be removed. The response specifies how long you can expect the playable locations to last. Once they expire, you should query the `samplePlayableLocations` API again to get a fresh view of the real world.

  ## Attributes

  *   `areaFilter` (*type:* `GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleAreaFilter.t`, *default:* `nil`) - Required. Specifies the area to search within for playable locations.
  *   `criteria` (*type:* `list(GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleCriterion.t)`, *default:* `nil`) - Required. Specifies one or more (up to 5) criteria for filtering the returned playable locations.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :areaFilter =>
            GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleAreaFilter.t()
            | nil,
          :criteria =>
            list(
              GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleCriterion.t()
            )
            | nil
        }

  field(:areaFilter,
    as: GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleAreaFilter
  )

  field(:criteria,
    as: GoogleApi.PlayableLocations.V3.Model.GoogleMapsPlayablelocationsV3SampleCriterion,
    type: :list
  )
end

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

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