# 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.GoogleCloudDialogflowCxV3Webhook do
  @moduledoc """
  Webhooks host the developer's business logic. During a session, webhooks allow the developer to use the data extracted by Dialogflow's natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend.

  ## Attributes

  *   `disabled` (*type:* `boolean()`, *default:* `nil`) - Indicates whether the webhook is disabled.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The human-readable name of the webhook, unique within the agent.
  *   `genericWebService` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookGenericWebService.t`, *default:* `nil`) - Configuration for a generic web service.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The unique identifier of the webhook. Required for the Webhooks.UpdateWebhook method. Webhooks.CreateWebhook populates the name automatically. Format: `projects//locations//agents//webhooks/`.
  *   `serviceDirectory` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookServiceDirectoryConfig.t`, *default:* `nil`) - Configuration for a [Service Directory](https://cloud.google.com/service-directory) service.
  *   `timeout` (*type:* `String.t`, *default:* `nil`) - Webhook execution timeout. Execution is considered failed if Dialogflow doesn't receive a response from webhook at the end of the timeout period. Defaults to 5 seconds, maximum allowed timeout is 30 seconds.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :disabled => boolean() | nil,
          :displayName => String.t() | nil,
          :genericWebService =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookGenericWebService.t()
            | nil,
          :name => String.t() | nil,
          :serviceDirectory =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookServiceDirectoryConfig.t()
            | nil,
          :timeout => String.t() | nil
        }

  field(:disabled)
  field(:displayName)

  field(:genericWebService,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookGenericWebService
  )

  field(:name)

  field(:serviceDirectory,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3WebhookServiceDirectoryConfig
  )

  field(:timeout)
end

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

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