# 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.V2.Model.GoogleCloudDialogflowCxV3beta1KnowledgeConnectorSettings do
  @moduledoc """
  The Knowledge Connector settings for this page or flow. This includes information such as the attached Knowledge Bases, and the way to execute fulfillment.

  ## Attributes

  *   `dataStoreConnections` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1DataStoreConnection.t)`, *default:* `nil`) - Optional. List of related data store connections.
  *   `enabled` (*type:* `boolean()`, *default:* `nil`) - Whether Knowledge Connector is enabled or not.
  *   `targetFlow` (*type:* `String.t`, *default:* `nil`) - The target flow to transition to. Format: `projects//locations//agents//flows/`.
  *   `targetPage` (*type:* `String.t`, *default:* `nil`) - The target page to transition to. Format: `projects//locations//agents//flows//pages/`.
  *   `triggerFulfillment` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment.t`, *default:* `nil`) - The fulfillment to be triggered. When the answers from the Knowledge Connector are selected by Dialogflow, you can utitlize the request scoped parameter `$request.knowledge.answers` (contains up to the 5 highest confidence answers) and `$request.knowledge.questions` (contains the corresponding questions) to construct the fulfillment.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dataStoreConnections =>
            list(
              GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1DataStoreConnection.t()
            )
            | nil,
          :enabled => boolean() | nil,
          :targetFlow => String.t() | nil,
          :targetPage => String.t() | nil,
          :triggerFulfillment =>
            GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment.t() | nil
        }

  field(:dataStoreConnections,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1DataStoreConnection,
    type: :list
  )

  field(:enabled)
  field(:targetFlow)
  field(:targetPage)

  field(:triggerFulfillment,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment
  )
end

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

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