# 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.CloudSearch.V1.Model.SearchResult do
  @moduledoc """
  Results containing indexed information for a document.

  ## Attributes

  *   `clusteredResults` (*type:* `list(GoogleApi.CloudSearch.V1.Model.SearchResult.t)`, *default:* `nil`) - If source is clustered, provide list of clustered results. There will only be one level of clustered results. If current source is not enabled for clustering, this field will be empty.
  *   `debugInfo` (*type:* `GoogleApi.CloudSearch.V1.Model.ResultDebugInfo.t`, *default:* `nil`) - Debugging information about this search result.
  *   `metadata` (*type:* `GoogleApi.CloudSearch.V1.Model.Metadata.t`, *default:* `nil`) - Metadata of the search result.
  *   `snippet` (*type:* `GoogleApi.CloudSearch.V1.Model.Snippet.t`, *default:* `nil`) - The concatenation of all snippets (summaries) available for this result.
  *   `title` (*type:* `String.t`, *default:* `nil`) - Title of the search result.
  *   `url` (*type:* `String.t`, *default:* `nil`) - The URL of the search result. The URL contains a Google redirect to the actual item. This URL is signed and shouldn't be changed.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clusteredResults => list(GoogleApi.CloudSearch.V1.Model.SearchResult.t()) | nil,
          :debugInfo => GoogleApi.CloudSearch.V1.Model.ResultDebugInfo.t() | nil,
          :metadata => GoogleApi.CloudSearch.V1.Model.Metadata.t() | nil,
          :snippet => GoogleApi.CloudSearch.V1.Model.Snippet.t() | nil,
          :title => String.t() | nil,
          :url => String.t() | nil
        }

  field(:clusteredResults, as: GoogleApi.CloudSearch.V1.Model.SearchResult, type: :list)
  field(:debugInfo, as: GoogleApi.CloudSearch.V1.Model.ResultDebugInfo)
  field(:metadata, as: GoogleApi.CloudSearch.V1.Model.Metadata)
  field(:snippet, as: GoogleApi.CloudSearch.V1.Model.Snippet)
  field(:title)
  field(:url)
end

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

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