# 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.Connectors.V1.Model.ConfigVariableTemplate do
  @moduledoc """
  ConfigVariableTemplate provides metadata about a `ConfigVariable` that is used in a Connection.

  ## Attributes

  *   `authorizationCodeLink` (*type:* `GoogleApi.Connectors.V1.Model.AuthorizationCodeLink.t`, *default:* `nil`) - Optional. Authorization code link options. To be populated if `ValueType` is `AUTHORIZATION_CODE`
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Optional. Display name of the parameter.
  *   `enumOptions` (*type:* `list(GoogleApi.Connectors.V1.Model.EnumOption.t)`, *default:* `nil`) - Optional. Enum options. To be populated if `ValueType` is `ENUM`
  *   `enumSource` (*type:* `String.t`, *default:* `nil`) - Optional. enum source denotes the source of api to fill the enum options
  *   `isAdvanced` (*type:* `boolean()`, *default:* `nil`) - Optional. Indicates if current template is part of advanced settings
  *   `key` (*type:* `String.t`, *default:* `nil`) - Optional. Key of the config variable.
  *   `locationType` (*type:* `String.t`, *default:* `nil`) - Optional. Location Tyep denotes where this value should be sent in BYOC connections.
  *   `multipleSelectConfig` (*type:* `GoogleApi.Connectors.V1.Model.MultipleSelectConfig.t`, *default:* `nil`) - Optional. MultipleSelectConfig represents the multiple options for a config variable.
  *   `required` (*type:* `boolean()`, *default:* `nil`) - Optional. Flag represents that this `ConfigVariable` must be provided for a connection.
  *   `requiredCondition` (*type:* `GoogleApi.Connectors.V1.Model.LogicalExpression.t`, *default:* `nil`) - Optional. Condition under which a field would be required. The condition can be represented in the form of a logical expression.
  *   `roleGrant` (*type:* `GoogleApi.Connectors.V1.Model.RoleGrant.t`, *default:* `nil`) - Optional. Role grant configuration for the config variable.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. State of the config variable.
  *   `validationRegex` (*type:* `String.t`, *default:* `nil`) - Optional. Regular expression in RE2 syntax used for validating the `value` of a `ConfigVariable`.
  *   `valueType` (*type:* `String.t`, *default:* `nil`) - Optional. Type of the parameter: string, int, bool etc. consider custom type for the benefit for the validation.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :authorizationCodeLink => GoogleApi.Connectors.V1.Model.AuthorizationCodeLink.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :enumOptions => list(GoogleApi.Connectors.V1.Model.EnumOption.t()) | nil,
          :enumSource => String.t() | nil,
          :isAdvanced => boolean() | nil,
          :key => String.t() | nil,
          :locationType => String.t() | nil,
          :multipleSelectConfig => GoogleApi.Connectors.V1.Model.MultipleSelectConfig.t() | nil,
          :required => boolean() | nil,
          :requiredCondition => GoogleApi.Connectors.V1.Model.LogicalExpression.t() | nil,
          :roleGrant => GoogleApi.Connectors.V1.Model.RoleGrant.t() | nil,
          :state => String.t() | nil,
          :validationRegex => String.t() | nil,
          :valueType => String.t() | nil
        }

  field(:authorizationCodeLink, as: GoogleApi.Connectors.V1.Model.AuthorizationCodeLink)
  field(:description)
  field(:displayName)
  field(:enumOptions, as: GoogleApi.Connectors.V1.Model.EnumOption, type: :list)
  field(:enumSource)
  field(:isAdvanced)
  field(:key)
  field(:locationType)
  field(:multipleSelectConfig, as: GoogleApi.Connectors.V1.Model.MultipleSelectConfig)
  field(:required)
  field(:requiredCondition, as: GoogleApi.Connectors.V1.Model.LogicalExpression)
  field(:roleGrant, as: GoogleApi.Connectors.V1.Model.RoleGrant)
  field(:state)
  field(:validationRegex)
  field(:valueType)
end

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

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