# 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.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionQueryPrediction do
  @moduledoc """
  Prediction results for a Query Autocomplete prediction.

  ## Attributes

  *   `structuredFormat` (*type:* `GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat.t`, *default:* `nil`) - A breakdown of the query prediction into main text containing the query and secondary text containing additional disambiguating features (such as a city or region). `structured_format` is recommended for developers who wish to show two separate, but related, UI elements. Developers who wish to show a single UI element may want to use `text` instead. They are two different ways to represent a query prediction. Users should not try to parse `structured_format` into `text` or vice versa.
  *   `text` (*type:* `GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText.t`, *default:* `nil`) - The predicted text. This text does not represent a Place, but rather a text query that could be used in a search endpoint (for example, Text Search). `text` is recommended for developers who wish to show a single UI element. Developers who wish to show two separate, but related, UI elements may want to use `structured_format` instead. They are two different ways to represent a query prediction. Users should not try to parse `structured_format` into `text` or vice versa. May be in mixed languages if the request `input` and `language_code` are in different languages or if part of the query does not have a translation from the local language to `language_code`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :structuredFormat =>
            GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat.t()
            | nil,
          :text =>
            GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText.t()
            | nil
        }

  field(:structuredFormat,
    as:
      GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat
  )

  field(:text,
    as:
      GoogleApi.Places.V1.Model.GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText
  )
end

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

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