# 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.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaTestIntegrationsRequest do
  @moduledoc """
  The request for testing an integration.

  ## Attributes

  *   `clientId` (*type:* `String.t`, *default:* `nil`) - Required. This is used to identify the client on whose behalf the event will be executed.
  *   `configParameters` (*type:* `map()`, *default:* `nil`) - Optional. Config parameters used during integration execution.
  *   `deadlineSecondsTime` (*type:* `DateTime.t`, *default:* `nil`) - Optional. custom deadline of the rpc
  *   `inputParameters` (*type:* `%{optional(String.t) => GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaValueType.t}`, *default:* `nil`) - Optional. Input parameters used during integration execution.
  *   `integrationVersion` (*type:* `GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaIntegrationVersion.t`, *default:* `nil`) - Required. integration config to execute the workflow
  *   `parameters` (*type:* `GoogleApi.Integrations.V1.Model.EnterpriseCrmFrontendsEventbusProtoEventParameters.t`, *default:* `nil`) - Optional. Passed in as parameters to each integration execution.
  *   `testMode` (*type:* `boolean()`, *default:* `nil`) - Optional. Can be specified in the event request, otherwise false (default). If true, enables tasks with condition "test_mode = true". If false, disables tasks with condition "test_mode = true" if global test mode (set by platform) is also false {@link EventBusConfig}.
  *   `triggerId` (*type:* `String.t`, *default:* `nil`) - Required. The trigger id of the integration trigger config. If both trigger_id and client_id is present, the integration is executed from the start tasks provided by the matching trigger config otherwise it is executed from the default start tasks.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clientId => String.t() | nil,
          :configParameters => map() | nil,
          :deadlineSecondsTime => DateTime.t() | nil,
          :inputParameters =>
            %{
              optional(String.t()) =>
                GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaValueType.t()
            }
            | nil,
          :integrationVersion =>
            GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaIntegrationVersion.t()
            | nil,
          :parameters =>
            GoogleApi.Integrations.V1.Model.EnterpriseCrmFrontendsEventbusProtoEventParameters.t()
            | nil,
          :testMode => boolean() | nil,
          :triggerId => String.t() | nil
        }

  field(:clientId)
  field(:configParameters, type: :map)
  field(:deadlineSecondsTime, as: DateTime)

  field(:inputParameters,
    as: GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaValueType,
    type: :map
  )

  field(:integrationVersion,
    as: GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaIntegrationVersion
  )

  field(:parameters,
    as: GoogleApi.Integrations.V1.Model.EnterpriseCrmFrontendsEventbusProtoEventParameters
  )

  field(:testMode)
  field(:triggerId)
end

defimpl Poison.Decoder,
  for: GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaTestIntegrationsRequest do
  def decode(value, options) do
    GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaTestIntegrationsRequest.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaTestIntegrationsRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
