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

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

-- | Configuration of the answering machine detection.
--
-- /See:/ 'newAnswerMachineDetectionConfig' smart constructor.
data AnswerMachineDetectionConfig = AnswerMachineDetectionConfig'
  { -- | The flag to indicate if answer machine detection analysis needs to be
    -- performed for a voice call. If set to @true@, @TrafficType@ must be set
    -- as @CAMPAIGN@.
    AnswerMachineDetectionConfig -> Maybe Bool
enableAnswerMachineDetection :: Prelude.Maybe Prelude.Bool,
    -- | Wait for the answering machine prompt.
    AnswerMachineDetectionConfig -> Maybe Bool
awaitAnswerMachinePrompt :: Prelude.Maybe Prelude.Bool
  }
  deriving (AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
(AnswerMachineDetectionConfig
 -> AnswerMachineDetectionConfig -> Bool)
-> (AnswerMachineDetectionConfig
    -> AnswerMachineDetectionConfig -> Bool)
-> Eq AnswerMachineDetectionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
$c/= :: AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
== :: AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
$c== :: AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
Prelude.Eq, ReadPrec [AnswerMachineDetectionConfig]
ReadPrec AnswerMachineDetectionConfig
Int -> ReadS AnswerMachineDetectionConfig
ReadS [AnswerMachineDetectionConfig]
(Int -> ReadS AnswerMachineDetectionConfig)
-> ReadS [AnswerMachineDetectionConfig]
-> ReadPrec AnswerMachineDetectionConfig
-> ReadPrec [AnswerMachineDetectionConfig]
-> Read AnswerMachineDetectionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnswerMachineDetectionConfig]
$creadListPrec :: ReadPrec [AnswerMachineDetectionConfig]
readPrec :: ReadPrec AnswerMachineDetectionConfig
$creadPrec :: ReadPrec AnswerMachineDetectionConfig
readList :: ReadS [AnswerMachineDetectionConfig]
$creadList :: ReadS [AnswerMachineDetectionConfig]
readsPrec :: Int -> ReadS AnswerMachineDetectionConfig
$creadsPrec :: Int -> ReadS AnswerMachineDetectionConfig
Prelude.Read, Int -> AnswerMachineDetectionConfig -> ShowS
[AnswerMachineDetectionConfig] -> ShowS
AnswerMachineDetectionConfig -> String
(Int -> AnswerMachineDetectionConfig -> ShowS)
-> (AnswerMachineDetectionConfig -> String)
-> ([AnswerMachineDetectionConfig] -> ShowS)
-> Show AnswerMachineDetectionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnswerMachineDetectionConfig] -> ShowS
$cshowList :: [AnswerMachineDetectionConfig] -> ShowS
show :: AnswerMachineDetectionConfig -> String
$cshow :: AnswerMachineDetectionConfig -> String
showsPrec :: Int -> AnswerMachineDetectionConfig -> ShowS
$cshowsPrec :: Int -> AnswerMachineDetectionConfig -> ShowS
Prelude.Show, (forall x.
 AnswerMachineDetectionConfig -> Rep AnswerMachineDetectionConfig x)
-> (forall x.
    Rep AnswerMachineDetectionConfig x -> AnswerMachineDetectionConfig)
-> Generic AnswerMachineDetectionConfig
forall x.
Rep AnswerMachineDetectionConfig x -> AnswerMachineDetectionConfig
forall x.
AnswerMachineDetectionConfig -> Rep AnswerMachineDetectionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnswerMachineDetectionConfig x -> AnswerMachineDetectionConfig
$cfrom :: forall x.
AnswerMachineDetectionConfig -> Rep AnswerMachineDetectionConfig x
Prelude.Generic)

-- |
-- Create a value of 'AnswerMachineDetectionConfig' 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:
--
-- 'enableAnswerMachineDetection', 'answerMachineDetectionConfig_enableAnswerMachineDetection' - The flag to indicate if answer machine detection analysis needs to be
-- performed for a voice call. If set to @true@, @TrafficType@ must be set
-- as @CAMPAIGN@.
--
-- 'awaitAnswerMachinePrompt', 'answerMachineDetectionConfig_awaitAnswerMachinePrompt' - Wait for the answering machine prompt.
newAnswerMachineDetectionConfig ::
  AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig :: AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig =
  AnswerMachineDetectionConfig' :: Maybe Bool -> Maybe Bool -> AnswerMachineDetectionConfig
AnswerMachineDetectionConfig'
    { $sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: Maybe Bool
enableAnswerMachineDetection =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: Maybe Bool
awaitAnswerMachinePrompt = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The flag to indicate if answer machine detection analysis needs to be
-- performed for a voice call. If set to @true@, @TrafficType@ must be set
-- as @CAMPAIGN@.
answerMachineDetectionConfig_enableAnswerMachineDetection :: Lens.Lens' AnswerMachineDetectionConfig (Prelude.Maybe Prelude.Bool)
answerMachineDetectionConfig_enableAnswerMachineDetection :: (Maybe Bool -> f (Maybe Bool))
-> AnswerMachineDetectionConfig -> f AnswerMachineDetectionConfig
answerMachineDetectionConfig_enableAnswerMachineDetection = (AnswerMachineDetectionConfig -> Maybe Bool)
-> (AnswerMachineDetectionConfig
    -> Maybe Bool -> AnswerMachineDetectionConfig)
-> Lens
     AnswerMachineDetectionConfig
     AnswerMachineDetectionConfig
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerMachineDetectionConfig' {Maybe Bool
enableAnswerMachineDetection :: Maybe Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
enableAnswerMachineDetection} -> Maybe Bool
enableAnswerMachineDetection) (\s :: AnswerMachineDetectionConfig
s@AnswerMachineDetectionConfig' {} Maybe Bool
a -> AnswerMachineDetectionConfig
s {$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: Maybe Bool
enableAnswerMachineDetection = Maybe Bool
a} :: AnswerMachineDetectionConfig)

-- | Wait for the answering machine prompt.
answerMachineDetectionConfig_awaitAnswerMachinePrompt :: Lens.Lens' AnswerMachineDetectionConfig (Prelude.Maybe Prelude.Bool)
answerMachineDetectionConfig_awaitAnswerMachinePrompt :: (Maybe Bool -> f (Maybe Bool))
-> AnswerMachineDetectionConfig -> f AnswerMachineDetectionConfig
answerMachineDetectionConfig_awaitAnswerMachinePrompt = (AnswerMachineDetectionConfig -> Maybe Bool)
-> (AnswerMachineDetectionConfig
    -> Maybe Bool -> AnswerMachineDetectionConfig)
-> Lens
     AnswerMachineDetectionConfig
     AnswerMachineDetectionConfig
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerMachineDetectionConfig' {Maybe Bool
awaitAnswerMachinePrompt :: Maybe Bool
$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
awaitAnswerMachinePrompt} -> Maybe Bool
awaitAnswerMachinePrompt) (\s :: AnswerMachineDetectionConfig
s@AnswerMachineDetectionConfig' {} Maybe Bool
a -> AnswerMachineDetectionConfig
s {$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: Maybe Bool
awaitAnswerMachinePrompt = Maybe Bool
a} :: AnswerMachineDetectionConfig)

instance
  Prelude.Hashable
    AnswerMachineDetectionConfig

instance Prelude.NFData AnswerMachineDetectionConfig

instance Core.ToJSON AnswerMachineDetectionConfig where
  toJSON :: AnswerMachineDetectionConfig -> Value
toJSON AnswerMachineDetectionConfig' {Maybe Bool
awaitAnswerMachinePrompt :: Maybe Bool
enableAnswerMachineDetection :: Maybe Bool
$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EnableAnswerMachineDetection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableAnswerMachineDetection,
            (Text
"AwaitAnswerMachinePrompt" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
awaitAnswerMachinePrompt
          ]
      )