{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Connect.Types.UserQuickConnectConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Connect.Types.UserQuickConnectConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the quick connect configuration settings for
-- a user. The contact flow must be of type Transfer to Agent.
--
-- /See:/ 'newUserQuickConnectConfig' smart constructor.
data UserQuickConnectConfig = UserQuickConnectConfig'
  { -- | The identifier of the user.
    UserQuickConnectConfig -> Text
userId :: Prelude.Text,
    -- | The identifier of the contact flow.
    UserQuickConnectConfig -> Text
contactFlowId :: Prelude.Text
  }
  deriving (UserQuickConnectConfig -> UserQuickConnectConfig -> Bool
(UserQuickConnectConfig -> UserQuickConnectConfig -> Bool)
-> (UserQuickConnectConfig -> UserQuickConnectConfig -> Bool)
-> Eq UserQuickConnectConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserQuickConnectConfig -> UserQuickConnectConfig -> Bool
$c/= :: UserQuickConnectConfig -> UserQuickConnectConfig -> Bool
== :: UserQuickConnectConfig -> UserQuickConnectConfig -> Bool
$c== :: UserQuickConnectConfig -> UserQuickConnectConfig -> Bool
Prelude.Eq, ReadPrec [UserQuickConnectConfig]
ReadPrec UserQuickConnectConfig
Int -> ReadS UserQuickConnectConfig
ReadS [UserQuickConnectConfig]
(Int -> ReadS UserQuickConnectConfig)
-> ReadS [UserQuickConnectConfig]
-> ReadPrec UserQuickConnectConfig
-> ReadPrec [UserQuickConnectConfig]
-> Read UserQuickConnectConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserQuickConnectConfig]
$creadListPrec :: ReadPrec [UserQuickConnectConfig]
readPrec :: ReadPrec UserQuickConnectConfig
$creadPrec :: ReadPrec UserQuickConnectConfig
readList :: ReadS [UserQuickConnectConfig]
$creadList :: ReadS [UserQuickConnectConfig]
readsPrec :: Int -> ReadS UserQuickConnectConfig
$creadsPrec :: Int -> ReadS UserQuickConnectConfig
Prelude.Read, Int -> UserQuickConnectConfig -> ShowS
[UserQuickConnectConfig] -> ShowS
UserQuickConnectConfig -> String
(Int -> UserQuickConnectConfig -> ShowS)
-> (UserQuickConnectConfig -> String)
-> ([UserQuickConnectConfig] -> ShowS)
-> Show UserQuickConnectConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserQuickConnectConfig] -> ShowS
$cshowList :: [UserQuickConnectConfig] -> ShowS
show :: UserQuickConnectConfig -> String
$cshow :: UserQuickConnectConfig -> String
showsPrec :: Int -> UserQuickConnectConfig -> ShowS
$cshowsPrec :: Int -> UserQuickConnectConfig -> ShowS
Prelude.Show, (forall x. UserQuickConnectConfig -> Rep UserQuickConnectConfig x)
-> (forall x.
    Rep UserQuickConnectConfig x -> UserQuickConnectConfig)
-> Generic UserQuickConnectConfig
forall x. Rep UserQuickConnectConfig x -> UserQuickConnectConfig
forall x. UserQuickConnectConfig -> Rep UserQuickConnectConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserQuickConnectConfig x -> UserQuickConnectConfig
$cfrom :: forall x. UserQuickConnectConfig -> Rep UserQuickConnectConfig x
Prelude.Generic)

-- |
-- Create a value of 'UserQuickConnectConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'userId', 'userQuickConnectConfig_userId' - The identifier of the user.
--
-- 'contactFlowId', 'userQuickConnectConfig_contactFlowId' - The identifier of the contact flow.
newUserQuickConnectConfig ::
  -- | 'userId'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  UserQuickConnectConfig
newUserQuickConnectConfig :: Text -> Text -> UserQuickConnectConfig
newUserQuickConnectConfig Text
pUserId_ Text
pContactFlowId_ =
  UserQuickConnectConfig' :: Text -> Text -> UserQuickConnectConfig
UserQuickConnectConfig'
    { $sel:userId:UserQuickConnectConfig' :: Text
userId = Text
pUserId_,
      $sel:contactFlowId:UserQuickConnectConfig' :: Text
contactFlowId = Text
pContactFlowId_
    }

-- | The identifier of the user.
userQuickConnectConfig_userId :: Lens.Lens' UserQuickConnectConfig Prelude.Text
userQuickConnectConfig_userId :: (Text -> f Text)
-> UserQuickConnectConfig -> f UserQuickConnectConfig
userQuickConnectConfig_userId = (UserQuickConnectConfig -> Text)
-> (UserQuickConnectConfig -> Text -> UserQuickConnectConfig)
-> Lens UserQuickConnectConfig UserQuickConnectConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserQuickConnectConfig' {Text
userId :: Text
$sel:userId:UserQuickConnectConfig' :: UserQuickConnectConfig -> Text
userId} -> Text
userId) (\s :: UserQuickConnectConfig
s@UserQuickConnectConfig' {} Text
a -> UserQuickConnectConfig
s {$sel:userId:UserQuickConnectConfig' :: Text
userId = Text
a} :: UserQuickConnectConfig)

-- | The identifier of the contact flow.
userQuickConnectConfig_contactFlowId :: Lens.Lens' UserQuickConnectConfig Prelude.Text
userQuickConnectConfig_contactFlowId :: (Text -> f Text)
-> UserQuickConnectConfig -> f UserQuickConnectConfig
userQuickConnectConfig_contactFlowId = (UserQuickConnectConfig -> Text)
-> (UserQuickConnectConfig -> Text -> UserQuickConnectConfig)
-> Lens UserQuickConnectConfig UserQuickConnectConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserQuickConnectConfig' {Text
contactFlowId :: Text
$sel:contactFlowId:UserQuickConnectConfig' :: UserQuickConnectConfig -> Text
contactFlowId} -> Text
contactFlowId) (\s :: UserQuickConnectConfig
s@UserQuickConnectConfig' {} Text
a -> UserQuickConnectConfig
s {$sel:contactFlowId:UserQuickConnectConfig' :: Text
contactFlowId = Text
a} :: UserQuickConnectConfig)

instance Core.FromJSON UserQuickConnectConfig where
  parseJSON :: Value -> Parser UserQuickConnectConfig
parseJSON =
    String
-> (Object -> Parser UserQuickConnectConfig)
-> Value
-> Parser UserQuickConnectConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserQuickConnectConfig"
      ( \Object
x ->
          Text -> Text -> UserQuickConnectConfig
UserQuickConnectConfig'
            (Text -> Text -> UserQuickConnectConfig)
-> Parser Text -> Parser (Text -> UserQuickConnectConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserId")
            Parser (Text -> UserQuickConnectConfig)
-> Parser Text -> Parser UserQuickConnectConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ContactFlowId")
      )

instance Prelude.Hashable UserQuickConnectConfig

instance Prelude.NFData UserQuickConnectConfig

instance Core.ToJSON UserQuickConnectConfig where
  toJSON :: UserQuickConnectConfig -> Value
toJSON UserQuickConnectConfig' {Text
contactFlowId :: Text
userId :: Text
$sel:contactFlowId:UserQuickConnectConfig' :: UserQuickConnectConfig -> Text
$sel:userId:UserQuickConnectConfig' :: UserQuickConnectConfig -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ContactFlowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactFlowId)
          ]
      )