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

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

-- | The outbound caller ID name, number, and outbound whisper flow.
--
-- /See:/ 'newOutboundCallerConfig' smart constructor.
data OutboundCallerConfig = OutboundCallerConfig'
  { -- | The caller ID number.
    OutboundCallerConfig -> Maybe Text
outboundCallerIdNumberId :: Prelude.Maybe Prelude.Text,
    -- | The caller ID name.
    OutboundCallerConfig -> Maybe Text
outboundCallerIdName :: Prelude.Maybe Prelude.Text,
    -- | The outbound whisper flow to be used during an outbound call.
    OutboundCallerConfig -> Maybe Text
outboundFlowId :: Prelude.Maybe Prelude.Text
  }
  deriving (OutboundCallerConfig -> OutboundCallerConfig -> Bool
(OutboundCallerConfig -> OutboundCallerConfig -> Bool)
-> (OutboundCallerConfig -> OutboundCallerConfig -> Bool)
-> Eq OutboundCallerConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutboundCallerConfig -> OutboundCallerConfig -> Bool
$c/= :: OutboundCallerConfig -> OutboundCallerConfig -> Bool
== :: OutboundCallerConfig -> OutboundCallerConfig -> Bool
$c== :: OutboundCallerConfig -> OutboundCallerConfig -> Bool
Prelude.Eq, ReadPrec [OutboundCallerConfig]
ReadPrec OutboundCallerConfig
Int -> ReadS OutboundCallerConfig
ReadS [OutboundCallerConfig]
(Int -> ReadS OutboundCallerConfig)
-> ReadS [OutboundCallerConfig]
-> ReadPrec OutboundCallerConfig
-> ReadPrec [OutboundCallerConfig]
-> Read OutboundCallerConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutboundCallerConfig]
$creadListPrec :: ReadPrec [OutboundCallerConfig]
readPrec :: ReadPrec OutboundCallerConfig
$creadPrec :: ReadPrec OutboundCallerConfig
readList :: ReadS [OutboundCallerConfig]
$creadList :: ReadS [OutboundCallerConfig]
readsPrec :: Int -> ReadS OutboundCallerConfig
$creadsPrec :: Int -> ReadS OutboundCallerConfig
Prelude.Read, Int -> OutboundCallerConfig -> ShowS
[OutboundCallerConfig] -> ShowS
OutboundCallerConfig -> String
(Int -> OutboundCallerConfig -> ShowS)
-> (OutboundCallerConfig -> String)
-> ([OutboundCallerConfig] -> ShowS)
-> Show OutboundCallerConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutboundCallerConfig] -> ShowS
$cshowList :: [OutboundCallerConfig] -> ShowS
show :: OutboundCallerConfig -> String
$cshow :: OutboundCallerConfig -> String
showsPrec :: Int -> OutboundCallerConfig -> ShowS
$cshowsPrec :: Int -> OutboundCallerConfig -> ShowS
Prelude.Show, (forall x. OutboundCallerConfig -> Rep OutboundCallerConfig x)
-> (forall x. Rep OutboundCallerConfig x -> OutboundCallerConfig)
-> Generic OutboundCallerConfig
forall x. Rep OutboundCallerConfig x -> OutboundCallerConfig
forall x. OutboundCallerConfig -> Rep OutboundCallerConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutboundCallerConfig x -> OutboundCallerConfig
$cfrom :: forall x. OutboundCallerConfig -> Rep OutboundCallerConfig x
Prelude.Generic)

-- |
-- Create a value of 'OutboundCallerConfig' 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:
--
-- 'outboundCallerIdNumberId', 'outboundCallerConfig_outboundCallerIdNumberId' - The caller ID number.
--
-- 'outboundCallerIdName', 'outboundCallerConfig_outboundCallerIdName' - The caller ID name.
--
-- 'outboundFlowId', 'outboundCallerConfig_outboundFlowId' - The outbound whisper flow to be used during an outbound call.
newOutboundCallerConfig ::
  OutboundCallerConfig
newOutboundCallerConfig :: OutboundCallerConfig
newOutboundCallerConfig =
  OutboundCallerConfig' :: Maybe Text -> Maybe Text -> Maybe Text -> OutboundCallerConfig
OutboundCallerConfig'
    { $sel:outboundCallerIdNumberId:OutboundCallerConfig' :: Maybe Text
outboundCallerIdNumberId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outboundCallerIdName:OutboundCallerConfig' :: Maybe Text
outboundCallerIdName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outboundFlowId:OutboundCallerConfig' :: Maybe Text
outboundFlowId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The caller ID number.
outboundCallerConfig_outboundCallerIdNumberId :: Lens.Lens' OutboundCallerConfig (Prelude.Maybe Prelude.Text)
outboundCallerConfig_outboundCallerIdNumberId :: (Maybe Text -> f (Maybe Text))
-> OutboundCallerConfig -> f OutboundCallerConfig
outboundCallerConfig_outboundCallerIdNumberId = (OutboundCallerConfig -> Maybe Text)
-> (OutboundCallerConfig -> Maybe Text -> OutboundCallerConfig)
-> Lens
     OutboundCallerConfig OutboundCallerConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallerConfig' {Maybe Text
outboundCallerIdNumberId :: Maybe Text
$sel:outboundCallerIdNumberId:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
outboundCallerIdNumberId} -> Maybe Text
outboundCallerIdNumberId) (\s :: OutboundCallerConfig
s@OutboundCallerConfig' {} Maybe Text
a -> OutboundCallerConfig
s {$sel:outboundCallerIdNumberId:OutboundCallerConfig' :: Maybe Text
outboundCallerIdNumberId = Maybe Text
a} :: OutboundCallerConfig)

-- | The caller ID name.
outboundCallerConfig_outboundCallerIdName :: Lens.Lens' OutboundCallerConfig (Prelude.Maybe Prelude.Text)
outboundCallerConfig_outboundCallerIdName :: (Maybe Text -> f (Maybe Text))
-> OutboundCallerConfig -> f OutboundCallerConfig
outboundCallerConfig_outboundCallerIdName = (OutboundCallerConfig -> Maybe Text)
-> (OutboundCallerConfig -> Maybe Text -> OutboundCallerConfig)
-> Lens
     OutboundCallerConfig OutboundCallerConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallerConfig' {Maybe Text
outboundCallerIdName :: Maybe Text
$sel:outboundCallerIdName:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
outboundCallerIdName} -> Maybe Text
outboundCallerIdName) (\s :: OutboundCallerConfig
s@OutboundCallerConfig' {} Maybe Text
a -> OutboundCallerConfig
s {$sel:outboundCallerIdName:OutboundCallerConfig' :: Maybe Text
outboundCallerIdName = Maybe Text
a} :: OutboundCallerConfig)

-- | The outbound whisper flow to be used during an outbound call.
outboundCallerConfig_outboundFlowId :: Lens.Lens' OutboundCallerConfig (Prelude.Maybe Prelude.Text)
outboundCallerConfig_outboundFlowId :: (Maybe Text -> f (Maybe Text))
-> OutboundCallerConfig -> f OutboundCallerConfig
outboundCallerConfig_outboundFlowId = (OutboundCallerConfig -> Maybe Text)
-> (OutboundCallerConfig -> Maybe Text -> OutboundCallerConfig)
-> Lens
     OutboundCallerConfig OutboundCallerConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCallerConfig' {Maybe Text
outboundFlowId :: Maybe Text
$sel:outboundFlowId:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
outboundFlowId} -> Maybe Text
outboundFlowId) (\s :: OutboundCallerConfig
s@OutboundCallerConfig' {} Maybe Text
a -> OutboundCallerConfig
s {$sel:outboundFlowId:OutboundCallerConfig' :: Maybe Text
outboundFlowId = Maybe Text
a} :: OutboundCallerConfig)

instance Core.FromJSON OutboundCallerConfig where
  parseJSON :: Value -> Parser OutboundCallerConfig
parseJSON =
    String
-> (Object -> Parser OutboundCallerConfig)
-> Value
-> Parser OutboundCallerConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutboundCallerConfig"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> OutboundCallerConfig
OutboundCallerConfig'
            (Maybe Text -> Maybe Text -> Maybe Text -> OutboundCallerConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> OutboundCallerConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutboundCallerIdNumberId")
            Parser (Maybe Text -> Maybe Text -> OutboundCallerConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> OutboundCallerConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutboundCallerIdName")
            Parser (Maybe Text -> OutboundCallerConfig)
-> Parser (Maybe Text) -> Parser OutboundCallerConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutboundFlowId")
      )

instance Prelude.Hashable OutboundCallerConfig

instance Prelude.NFData OutboundCallerConfig

instance Core.ToJSON OutboundCallerConfig where
  toJSON :: OutboundCallerConfig -> Value
toJSON OutboundCallerConfig' {Maybe Text
outboundFlowId :: Maybe Text
outboundCallerIdName :: Maybe Text
outboundCallerIdNumberId :: Maybe Text
$sel:outboundFlowId:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
$sel:outboundCallerIdName:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
$sel:outboundCallerIdNumberId:OutboundCallerConfig' :: OutboundCallerConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OutboundCallerIdNumberId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outboundCallerIdNumberId,
            (Text
"OutboundCallerIdName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outboundCallerIdName,
            (Text
"OutboundFlowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outboundFlowId
          ]
      )