# 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.GoogleCloudRetailV2SearchResponseConversationalSearchResult do
  @moduledoc """
  This field specifies all related information that is needed on client side for UI rendering of conversational retail search.

  ## Attributes

  *   `additionalFilter` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter.t`, *default:* `nil`) - This is the incremental additional filters implied from the current user answer. User should add the suggested addition filters to the previous SearchRequest.filter, and use the merged filter in the follow up search request.
  *   `additionalFilters` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter.t)`, *default:* `nil`) - This field is deprecated but will be kept for backward compatibility. There is expected to have only one additional filter and the value will be the same to the same as field `additional_filter`.
  *   `conversationId` (*type:* `String.t`, *default:* `nil`) - Conversation UUID. This field will be stored in client side storage to maintain the conversation session with server and will be used for next search request's SearchRequest.ConversationalSearchSpec.conversation_id to restore conversation state in server.
  *   `followupQuestion` (*type:* `String.t`, *default:* `nil`) - The follow-up question. e.g., `What is the color?`
  *   `refinedQuery` (*type:* `String.t`, *default:* `nil`) - The current refined query for the conversational search. This field will be used in customer UI that the query in the search bar should be replaced with the refined query. For example, if SearchRequest.query is `dress` and next SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer is `red color`, which does not match any product attribute value filters, the refined query will be `dress, red color`.
  *   `suggestedAnswers` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultSuggestedAnswer.t)`, *default:* `nil`) - The answer options provided to client for the follow-up question.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :additionalFilter =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter.t()
            | nil,
          :additionalFilters =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter.t()
            )
            | nil,
          :conversationId => String.t() | nil,
          :followupQuestion => String.t() | nil,
          :refinedQuery => String.t() | nil,
          :suggestedAnswers =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultSuggestedAnswer.t()
            )
            | nil
        }

  field(:additionalFilter,
    as:
      GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter
  )

  field(:additionalFilters,
    as:
      GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultAdditionalFilter,
    type: :list
  )

  field(:conversationId)
  field(:followupQuestion)
  field(:refinedQuery)

  field(:suggestedAnswers,
    as:
      GoogleApi.Retail.V2.Model.GoogleCloudRetailV2SearchResponseConversationalSearchResultSuggestedAnswer,
    type: :list
  )
end

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

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