# 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.GoogleCloudConnectorsV1AuthConfigOauth2AuthCodeFlow do
  @moduledoc """
  Parameters to support Oauth 2.0 Auth Code Grant Authentication. See https://www.rfc-editor.org/rfc/rfc6749#section-1.3.1 for more details.

  ## Attributes

  *   `authCode` (*type:* `String.t`, *default:* `nil`) - Authorization code to be exchanged for access and refresh tokens.
  *   `authUri` (*type:* `String.t`, *default:* `nil`) - Auth URL for Authorization Code Flow
  *   `clientId` (*type:* `String.t`, *default:* `nil`) - Client ID for user-provided OAuth app.
  *   `clientSecret` (*type:* `GoogleApi.Integrations.V1.Model.GoogleCloudConnectorsV1Secret.t`, *default:* `nil`) - Client secret for user-provided OAuth app.
  *   `enablePkce` (*type:* `boolean()`, *default:* `nil`) - Whether to enable PKCE when the user performs the auth code flow.
  *   `pkceVerifier` (*type:* `String.t`, *default:* `nil`) - PKCE verifier to be used during the auth code exchange.
  *   `redirectUri` (*type:* `String.t`, *default:* `nil`) - Redirect URI to be provided during the auth code exchange.
  *   `scopes` (*type:* `list(String.t)`, *default:* `nil`) - Scopes the connection will request when the user performs the auth code flow.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :authCode => String.t() | nil,
          :authUri => String.t() | nil,
          :clientId => String.t() | nil,
          :clientSecret =>
            GoogleApi.Integrations.V1.Model.GoogleCloudConnectorsV1Secret.t() | nil,
          :enablePkce => boolean() | nil,
          :pkceVerifier => String.t() | nil,
          :redirectUri => String.t() | nil,
          :scopes => list(String.t()) | nil
        }

  field(:authCode)
  field(:authUri)
  field(:clientId)
  field(:clientSecret, as: GoogleApi.Integrations.V1.Model.GoogleCloudConnectorsV1Secret)
  field(:enablePkce)
  field(:pkceVerifier)
  field(:redirectUri)
  field(:scopes, type: :list)
end

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

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