# 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.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3QueryResult do
  @moduledoc """
  Represents the result of a conversational query.

  ## Attributes

  *   `advancedSettings` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3AdvancedSettings.t`, *default:* `nil`) - Returns the current advanced settings including IVR settings. Even though the operations configured by these settings are performed by Dialogflow, the client may need to perform special logic at the moment. For example, if Dialogflow exports audio to Google Cloud Storage, then the client may need to wait for the resulting object to appear in the bucket before proceeding.
  *   `allowAnswerFeedback` (*type:* `boolean()`, *default:* `nil`) - Indicates whether the Thumbs up/Thumbs down rating controls are need to be shown for the response in the Dialogflow Messenger widget.
  *   `currentPage` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Page.t`, *default:* `nil`) - The current Page. Some, not all fields are filled in this message, including but not limited to `name` and `display_name`.
  *   `dataStoreConnectionSignals` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DataStoreConnectionSignals.t`, *default:* `nil`) - Optional. Data store connection feature output signals. Filled only when data stores are involved in serving the query.
  *   `diagnosticInfo` (*type:* `map()`, *default:* `nil`) - The free-form diagnostic info. For example, this field could contain webhook call latency. The fields of this data can change without notice, so you should not write code that depends on its structure. One of the fields is called "Alternative Matched Intents", which may aid with debugging. The following describes these intent results: - The list is empty if no intent was matched to end-user input. - Only intents that are referenced in the currently active flow are included. - The matched intent is included. - Other intents that could have matched end-user input, but did not match because they are referenced by intent routes that are out of [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), are included. - Other intents referenced by intent routes in scope that matched end-user input, but had a lower confidence score.
  *   `dtmf` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DtmfInput.t`, *default:* `nil`) - If a DTMF was provided as input, this field will contain a copy of the DtmfInput.
  *   `intent` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Intent.t`, *default:* `nil`) - The Intent that matched the conversational query. Some, not all fields are filled in this message, including but not limited to: `name` and `display_name`. This field is deprecated, please use QueryResult.match instead.
  *   `intentDetectionConfidence` (*type:* `number()`, *default:* `nil`) - The intent detection confidence. Values range from 0.0 (completely uncertain) to 1.0 (completely certain). This value is for informational purpose only and is only used to help match the best intent within the classification threshold. This value may change for the same end-user expression at any time due to a model retraining or change in implementation. This field is deprecated, please use QueryResult.match instead.
  *   `languageCode` (*type:* `String.t`, *default:* `nil`) - The language that was triggered during intent detection. See [Language Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) for a list of the currently supported language codes.
  *   `match` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Match.t`, *default:* `nil`) - Intent match result, could be an intent or an event.
  *   `parameters` (*type:* `map()`, *default:* `nil`) - The collected session parameters. Depending on your protocol or client library language, this is a map, associative array, symbol table, dictionary, or JSON object composed of a collection of (MapKey, MapValue) pairs: * MapKey type: string * MapKey value: parameter name * MapValue type: If parameter's entity type is a composite entity then use map, otherwise, depending on the parameter value type, it could be one of string, number, boolean, null, list or map. * MapValue value: If parameter's entity type is a composite entity then use map from composite entity property names to property values, otherwise, use parameter value.
  *   `responseMessages` (*type:* `list(GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3ResponseMessage.t)`, *default:* `nil`) - The list of rich messages returned to the client. Responses vary from simple text messages to more sophisticated, structured payloads used to drive complex logic.
  *   `sentimentAnalysisResult` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3SentimentAnalysisResult.t`, *default:* `nil`) - The sentiment analyss result, which depends on `analyze_query_text_sentiment`, specified in the request.
  *   `text` (*type:* `String.t`, *default:* `nil`) - If natural language text was provided as input, this field will contain a copy of the text.
  *   `transcript` (*type:* `String.t`, *default:* `nil`) - If natural language speech audio was provided as input, this field will contain the transcript for the audio.
  *   `triggerEvent` (*type:* `String.t`, *default:* `nil`) - If an event was provided as input, this field will contain the name of the event.
  *   `triggerIntent` (*type:* `String.t`, *default:* `nil`) - If an intent was provided as input, this field will contain a copy of the intent identifier. Format: `projects//locations//agents//intents/`.
  *   `webhookPayloads` (*type:* `list(map())`, *default:* `nil`) - The list of webhook payload in WebhookResponse.payload, in the order of call sequence. If some webhook call fails or doesn't return any payload, an empty `Struct` would be used instead.
  *   `webhookStatuses` (*type:* `list(GoogleApi.Dialogflow.V3.Model.GoogleRpcStatus.t)`, *default:* `nil`) - The list of webhook call status in the order of call sequence.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :advancedSettings =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3AdvancedSettings.t() | nil,
          :allowAnswerFeedback => boolean() | nil,
          :currentPage => GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Page.t() | nil,
          :dataStoreConnectionSignals =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DataStoreConnectionSignals.t()
            | nil,
          :diagnosticInfo => map() | nil,
          :dtmf => GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DtmfInput.t() | nil,
          :intent => GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Intent.t() | nil,
          :intentDetectionConfidence => number() | nil,
          :languageCode => String.t() | nil,
          :match => GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Match.t() | nil,
          :parameters => map() | nil,
          :responseMessages =>
            list(GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3ResponseMessage.t()) | nil,
          :sentimentAnalysisResult =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3SentimentAnalysisResult.t()
            | nil,
          :text => String.t() | nil,
          :transcript => String.t() | nil,
          :triggerEvent => String.t() | nil,
          :triggerIntent => String.t() | nil,
          :webhookPayloads => list(map()) | nil,
          :webhookStatuses => list(GoogleApi.Dialogflow.V3.Model.GoogleRpcStatus.t()) | nil
        }

  field(:advancedSettings,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3AdvancedSettings
  )

  field(:allowAnswerFeedback)
  field(:currentPage, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Page)

  field(:dataStoreConnectionSignals,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DataStoreConnectionSignals
  )

  field(:diagnosticInfo, type: :map)
  field(:dtmf, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3DtmfInput)
  field(:intent, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Intent)
  field(:intentDetectionConfidence)
  field(:languageCode)
  field(:match, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Match)
  field(:parameters, type: :map)

  field(:responseMessages,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3ResponseMessage,
    type: :list
  )

  field(:sentimentAnalysisResult,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3SentimentAnalysisResult
  )

  field(:text)
  field(:transcript)
  field(:triggerEvent)
  field(:triggerIntent)
  field(:webhookPayloads, type: :list)
  field(:webhookStatuses, as: GoogleApi.Dialogflow.V3.Model.GoogleRpcStatus, type: :list)
end

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

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