{-# 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.ConnectCampaigns.Types.OutboundCallConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ConnectCampaigns.Types.OutboundCallConfig where

import Amazonka.ConnectCampaigns.Types.AnswerMachineDetectionConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The configuration used for outbound calls.
--
-- /See:/ 'newOutboundCallConfig' smart constructor.
data OutboundCallConfig = OutboundCallConfig'
  { OutboundCallConfig -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig :: Prelude.Maybe AnswerMachineDetectionConfig,
    OutboundCallConfig -> Maybe Text
connectSourcePhoneNumber :: Prelude.Maybe Prelude.Text,
    OutboundCallConfig -> Text
connectContactFlowId :: Prelude.Text,
    OutboundCallConfig -> Text
connectQueueId :: Prelude.Text
  }
  deriving (OutboundCallConfig -> OutboundCallConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutboundCallConfig -> OutboundCallConfig -> Bool
$c/= :: OutboundCallConfig -> OutboundCallConfig -> Bool
== :: OutboundCallConfig -> OutboundCallConfig -> Bool
$c== :: OutboundCallConfig -> OutboundCallConfig -> Bool
Prelude.Eq, ReadPrec [OutboundCallConfig]
ReadPrec OutboundCallConfig
Int -> ReadS OutboundCallConfig
ReadS [OutboundCallConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutboundCallConfig]
$creadListPrec :: ReadPrec [OutboundCallConfig]
readPrec :: ReadPrec OutboundCallConfig
$creadPrec :: ReadPrec OutboundCallConfig
readList :: ReadS [OutboundCallConfig]
$creadList :: ReadS [OutboundCallConfig]
readsPrec :: Int -> ReadS OutboundCallConfig
$creadsPrec :: Int -> ReadS OutboundCallConfig
Prelude.Read, Int -> OutboundCallConfig -> ShowS
[OutboundCallConfig] -> ShowS
OutboundCallConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutboundCallConfig] -> ShowS
$cshowList :: [OutboundCallConfig] -> ShowS
show :: OutboundCallConfig -> String
$cshow :: OutboundCallConfig -> String
showsPrec :: Int -> OutboundCallConfig -> ShowS
$cshowsPrec :: Int -> OutboundCallConfig -> ShowS
Prelude.Show, forall x. Rep OutboundCallConfig x -> OutboundCallConfig
forall x. OutboundCallConfig -> Rep OutboundCallConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutboundCallConfig x -> OutboundCallConfig
$cfrom :: forall x. OutboundCallConfig -> Rep OutboundCallConfig x
Prelude.Generic)

-- |
-- Create a value of 'OutboundCallConfig' 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:
--
-- 'answerMachineDetectionConfig', 'outboundCallConfig_answerMachineDetectionConfig' - Undocumented member.
--
-- 'connectSourcePhoneNumber', 'outboundCallConfig_connectSourcePhoneNumber' - Undocumented member.
--
-- 'connectContactFlowId', 'outboundCallConfig_connectContactFlowId' - Undocumented member.
--
-- 'connectQueueId', 'outboundCallConfig_connectQueueId' - Undocumented member.
newOutboundCallConfig ::
  -- | 'connectContactFlowId'
  Prelude.Text ->
  -- | 'connectQueueId'
  Prelude.Text ->
  OutboundCallConfig
newOutboundCallConfig :: Text -> Text -> OutboundCallConfig
newOutboundCallConfig
  Text
pConnectContactFlowId_
  Text
pConnectQueueId_ =
    OutboundCallConfig'
      { $sel:answerMachineDetectionConfig:OutboundCallConfig' :: Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig =
          forall a. Maybe a
Prelude.Nothing,
        $sel:connectSourcePhoneNumber:OutboundCallConfig' :: Maybe Text
connectSourcePhoneNumber = forall a. Maybe a
Prelude.Nothing,
        $sel:connectContactFlowId:OutboundCallConfig' :: Text
connectContactFlowId = Text
pConnectContactFlowId_,
        $sel:connectQueueId:OutboundCallConfig' :: Text
connectQueueId = Text
pConnectQueueId_
      }

-- | Undocumented member.
outboundCallConfig_answerMachineDetectionConfig :: Lens.Lens' OutboundCallConfig (Prelude.Maybe AnswerMachineDetectionConfig)
outboundCallConfig_answerMachineDetectionConfig :: Lens' OutboundCallConfig (Maybe AnswerMachineDetectionConfig)
outboundCallConfig_answerMachineDetectionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallConfig' {Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:answerMachineDetectionConfig:OutboundCallConfig' :: OutboundCallConfig -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig} -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig) (\s :: OutboundCallConfig
s@OutboundCallConfig' {} Maybe AnswerMachineDetectionConfig
a -> OutboundCallConfig
s {$sel:answerMachineDetectionConfig:OutboundCallConfig' :: Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig = Maybe AnswerMachineDetectionConfig
a} :: OutboundCallConfig)

-- | Undocumented member.
outboundCallConfig_connectSourcePhoneNumber :: Lens.Lens' OutboundCallConfig (Prelude.Maybe Prelude.Text)
outboundCallConfig_connectSourcePhoneNumber :: Lens' OutboundCallConfig (Maybe Text)
outboundCallConfig_connectSourcePhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallConfig' {Maybe Text
connectSourcePhoneNumber :: Maybe Text
$sel:connectSourcePhoneNumber:OutboundCallConfig' :: OutboundCallConfig -> Maybe Text
connectSourcePhoneNumber} -> Maybe Text
connectSourcePhoneNumber) (\s :: OutboundCallConfig
s@OutboundCallConfig' {} Maybe Text
a -> OutboundCallConfig
s {$sel:connectSourcePhoneNumber:OutboundCallConfig' :: Maybe Text
connectSourcePhoneNumber = Maybe Text
a} :: OutboundCallConfig)

-- | Undocumented member.
outboundCallConfig_connectContactFlowId :: Lens.Lens' OutboundCallConfig Prelude.Text
outboundCallConfig_connectContactFlowId :: Lens' OutboundCallConfig Text
outboundCallConfig_connectContactFlowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallConfig' {Text
connectContactFlowId :: Text
$sel:connectContactFlowId:OutboundCallConfig' :: OutboundCallConfig -> Text
connectContactFlowId} -> Text
connectContactFlowId) (\s :: OutboundCallConfig
s@OutboundCallConfig' {} Text
a -> OutboundCallConfig
s {$sel:connectContactFlowId:OutboundCallConfig' :: Text
connectContactFlowId = Text
a} :: OutboundCallConfig)

-- | Undocumented member.
outboundCallConfig_connectQueueId :: Lens.Lens' OutboundCallConfig Prelude.Text
outboundCallConfig_connectQueueId :: Lens' OutboundCallConfig Text
outboundCallConfig_connectQueueId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallConfig' {Text
connectQueueId :: Text
$sel:connectQueueId:OutboundCallConfig' :: OutboundCallConfig -> Text
connectQueueId} -> Text
connectQueueId) (\s :: OutboundCallConfig
s@OutboundCallConfig' {} Text
a -> OutboundCallConfig
s {$sel:connectQueueId:OutboundCallConfig' :: Text
connectQueueId = Text
a} :: OutboundCallConfig)

instance Data.FromJSON OutboundCallConfig where
  parseJSON :: Value -> Parser OutboundCallConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutboundCallConfig"
      ( \Object
x ->
          Maybe AnswerMachineDetectionConfig
-> Maybe Text -> Text -> Text -> OutboundCallConfig
OutboundCallConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"answerMachineDetectionConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"connectSourcePhoneNumber")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"connectContactFlowId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"connectQueueId")
      )

instance Prelude.Hashable OutboundCallConfig where
  hashWithSalt :: Int -> OutboundCallConfig -> Int
hashWithSalt Int
_salt OutboundCallConfig' {Maybe Text
Maybe AnswerMachineDetectionConfig
Text
connectQueueId :: Text
connectContactFlowId :: Text
connectSourcePhoneNumber :: Maybe Text
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:connectQueueId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectContactFlowId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectSourcePhoneNumber:OutboundCallConfig' :: OutboundCallConfig -> Maybe Text
$sel:answerMachineDetectionConfig:OutboundCallConfig' :: OutboundCallConfig -> Maybe AnswerMachineDetectionConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectSourcePhoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectContactFlowId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectQueueId

instance Prelude.NFData OutboundCallConfig where
  rnf :: OutboundCallConfig -> ()
rnf OutboundCallConfig' {Maybe Text
Maybe AnswerMachineDetectionConfig
Text
connectQueueId :: Text
connectContactFlowId :: Text
connectSourcePhoneNumber :: Maybe Text
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:connectQueueId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectContactFlowId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectSourcePhoneNumber:OutboundCallConfig' :: OutboundCallConfig -> Maybe Text
$sel:answerMachineDetectionConfig:OutboundCallConfig' :: OutboundCallConfig -> Maybe AnswerMachineDetectionConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectSourcePhoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectContactFlowId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectQueueId

instance Data.ToJSON OutboundCallConfig where
  toJSON :: OutboundCallConfig -> Value
toJSON OutboundCallConfig' {Maybe Text
Maybe AnswerMachineDetectionConfig
Text
connectQueueId :: Text
connectContactFlowId :: Text
connectSourcePhoneNumber :: Maybe Text
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:connectQueueId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectContactFlowId:OutboundCallConfig' :: OutboundCallConfig -> Text
$sel:connectSourcePhoneNumber:OutboundCallConfig' :: OutboundCallConfig -> Maybe Text
$sel:answerMachineDetectionConfig:OutboundCallConfig' :: OutboundCallConfig -> Maybe AnswerMachineDetectionConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"answerMachineDetectionConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig,
            (Key
"connectSourcePhoneNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectSourcePhoneNumber,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"connectContactFlowId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectContactFlowId
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"connectQueueId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectQueueId)
          ]
      )