# 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.Retail.V2.Model.GoogleCloudRetailV2SearchResponse do
  @moduledoc """
  Response message for SearchService.Search method.

  ## Attributes

  *   `appliedControls` (*type:* `list(String.t)`, *default:* `nil`) - The fully qualified resource name of applied [controls](https://cloud.google.com/retail/docs/serving-control-rules).
  *   `attributionToken` (*type:* `String.t`, *default:* `nil`) - A unique search token. This should be included in the UserEvent logs resulting from this search, which enables accurate attribution of search model performance.
  *   `conversationalSearchResult` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResult.t`, *default:* `nil`) - This field specifies all related information that is needed on client side for UI rendering of conversational retail search.
  *   `correctedQuery` (*type:* `String.t`, *default:* `nil`) - Contains the spell corrected query, if found. If the spell correction type is AUTOMATIC, then the search results are based on corrected_query. Otherwise the original query is used for search.
  *   `experimentInfo` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2ExperimentInfo.t)`, *default:* `nil`) - Metadata related to A/B testing experiment associated with this response. Only exists when an experiment is triggered.
  *   `facets` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseFacet.t)`, *default:* `nil`) - Results of facets requested by user.
  *   `invalidConditionBoostSpecs` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchRequestBoostSpecConditionBoostSpec.t)`, *default:* `nil`) - The invalid SearchRequest.BoostSpec.condition_boost_specs that are not applied during serving.
  *   `nextPageToken` (*type:* `String.t`, *default:* `nil`) - A token that can be sent as SearchRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
  *   `pinControlMetadata` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2PinControlMetadata.t`, *default:* `nil`) - Metadata for pin controls which were applicable to the request. This contains two map fields, one for all matched pins and one for pins which were matched but not applied. The two maps are keyed by pin position, and the values are the product ids which were matched to that pin.
  *   `queryExpansionInfo` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseQueryExpansionInfo.t`, *default:* `nil`) - Query expansion information for the returned results.
  *   `redirectUri` (*type:* `String.t`, *default:* `nil`) - The URI of a customer-defined redirect page. If redirect action is triggered, no search is performed, and only redirect_uri and attribution_token are set in the response.
  *   `results` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseSearchResult.t)`, *default:* `nil`) - A list of matched items. The order represents the ranking.
  *   `tileNavigationResult` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseTileNavigationResult.t`, *default:* `nil`) - This field specifies all related information for tile navigation that will be used in client side.
  *   `totalSize` (*type:* `integer()`, *default:* `nil`) - The estimated total count of matched items irrespective of pagination. The count of results returned by pagination may be less than the total_size that matches.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :appliedControls => list(String.t()) | nil,
          :attributionToken => String.t() | nil,
          :conversationalSearchResult =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResult.t()
            | nil,
          :correctedQuery => String.t() | nil,
          :experimentInfo =>
            list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2ExperimentInfo.t()) | nil,
          :facets =>
            list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseFacet.t()) | nil,
          :invalidConditionBoostSpecs =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchRequestBoostSpecConditionBoostSpec.t()
            )
            | nil,
          :nextPageToken => String.t() | nil,
          :pinControlMetadata =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2PinControlMetadata.t() | nil,
          :queryExpansionInfo =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseQueryExpansionInfo.t()
            | nil,
          :redirectUri => String.t() | nil,
          :results =>
            list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseSearchResult.t())
            | nil,
          :tileNavigationResult =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseTileNavigationResult.t()
            | nil,
          :totalSize => integer() | nil
        }

  field(:appliedControls, type: :list)
  field(:attributionToken)

  field(:conversationalSearchResult,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResult
  )

  field(:correctedQuery)

  field(:experimentInfo,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2ExperimentInfo,
    type: :list
  )

  field(:facets, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseFacet, type: :list)

  field(:invalidConditionBoostSpecs,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchRequestBoostSpecConditionBoostSpec,
    type: :list
  )

  field(:nextPageToken)
  field(:pinControlMetadata, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2PinControlMetadata)

  field(:queryExpansionInfo,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseQueryExpansionInfo
  )

  field(:redirectUri)

  field(:results,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseSearchResult,
    type: :list
  )

  field(:tileNavigationResult,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseTileNavigationResult
  )

  field(:totalSize)
end

defimpl Poison.Decoder, for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponse do
  def decode(value, options) do
    GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
