{-# 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.QueueQuickConnectConfig
-- 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.QueueQuickConnectConfig where

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

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

-- |
-- Create a value of 'QueueQuickConnectConfig' 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:
--
-- 'queueId', 'queueQuickConnectConfig_queueId' - The identifier for the queue.
--
-- 'contactFlowId', 'queueQuickConnectConfig_contactFlowId' - The identifier of the contact flow.
newQueueQuickConnectConfig ::
  -- | 'queueId'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  QueueQuickConnectConfig
newQueueQuickConnectConfig :: Text -> Text -> QueueQuickConnectConfig
newQueueQuickConnectConfig Text
pQueueId_ Text
pContactFlowId_ =
  QueueQuickConnectConfig' :: Text -> Text -> QueueQuickConnectConfig
QueueQuickConnectConfig'
    { $sel:queueId:QueueQuickConnectConfig' :: Text
queueId = Text
pQueueId_,
      $sel:contactFlowId:QueueQuickConnectConfig' :: Text
contactFlowId = Text
pContactFlowId_
    }

-- | The identifier for the queue.
queueQuickConnectConfig_queueId :: Lens.Lens' QueueQuickConnectConfig Prelude.Text
queueQuickConnectConfig_queueId :: (Text -> f Text)
-> QueueQuickConnectConfig -> f QueueQuickConnectConfig
queueQuickConnectConfig_queueId = (QueueQuickConnectConfig -> Text)
-> (QueueQuickConnectConfig -> Text -> QueueQuickConnectConfig)
-> Lens QueueQuickConnectConfig QueueQuickConnectConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueQuickConnectConfig' {Text
queueId :: Text
$sel:queueId:QueueQuickConnectConfig' :: QueueQuickConnectConfig -> Text
queueId} -> Text
queueId) (\s :: QueueQuickConnectConfig
s@QueueQuickConnectConfig' {} Text
a -> QueueQuickConnectConfig
s {$sel:queueId:QueueQuickConnectConfig' :: Text
queueId = Text
a} :: QueueQuickConnectConfig)

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

instance Core.FromJSON QueueQuickConnectConfig where
  parseJSON :: Value -> Parser QueueQuickConnectConfig
parseJSON =
    String
-> (Object -> Parser QueueQuickConnectConfig)
-> Value
-> Parser QueueQuickConnectConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"QueueQuickConnectConfig"
      ( \Object
x ->
          Text -> Text -> QueueQuickConnectConfig
QueueQuickConnectConfig'
            (Text -> Text -> QueueQuickConnectConfig)
-> Parser Text -> Parser (Text -> QueueQuickConnectConfig)
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
"QueueId")
            Parser (Text -> QueueQuickConnectConfig)
-> Parser Text -> Parser QueueQuickConnectConfig
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 QueueQuickConnectConfig

instance Prelude.NFData QueueQuickConnectConfig

instance Core.ToJSON QueueQuickConnectConfig where
  toJSON :: QueueQuickConnectConfig -> Value
toJSON QueueQuickConnectConfig' {Text
contactFlowId :: Text
queueId :: Text
$sel:contactFlowId:QueueQuickConnectConfig' :: QueueQuickConnectConfig -> Text
$sel:queueId:QueueQuickConnectConfig' :: QueueQuickConnectConfig -> 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
"QueueId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queueId),
            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)
          ]
      )