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

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

-- | Configuration of the answering machine detection.
--
-- /See:/ 'newAnswerMachineDetectionConfig' smart constructor.
data AnswerMachineDetectionConfig = AnswerMachineDetectionConfig'
  { -- | Wait for the answering machine prompt.
    AnswerMachineDetectionConfig -> Maybe Bool
awaitAnswerMachinePrompt :: Prelude.Maybe Prelude.Bool,
    -- | 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
  }
  deriving (AnswerMachineDetectionConfig
-> AnswerMachineDetectionConfig -> Bool
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]
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
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.
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:
--
-- 'awaitAnswerMachinePrompt', 'answerMachineDetectionConfig_awaitAnswerMachinePrompt' - Wait for the answering machine prompt.
--
-- '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@.
newAnswerMachineDetectionConfig ::
  AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig :: AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig =
  AnswerMachineDetectionConfig'
    { $sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: Maybe Bool
awaitAnswerMachinePrompt =
        forall a. Maybe a
Prelude.Nothing,
      $sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: Maybe Bool
enableAnswerMachineDetection =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Wait for the answering machine prompt.
answerMachineDetectionConfig_awaitAnswerMachinePrompt :: Lens.Lens' AnswerMachineDetectionConfig (Prelude.Maybe Prelude.Bool)
answerMachineDetectionConfig_awaitAnswerMachinePrompt :: Lens' AnswerMachineDetectionConfig (Maybe Bool)
answerMachineDetectionConfig_awaitAnswerMachinePrompt = 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)

-- | 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 :: Lens' AnswerMachineDetectionConfig (Maybe Bool)
answerMachineDetectionConfig_enableAnswerMachineDetection = 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)

instance
  Prelude.Hashable
    AnswerMachineDetectionConfig
  where
  hashWithSalt :: Int -> AnswerMachineDetectionConfig -> Int
hashWithSalt Int
_salt AnswerMachineDetectionConfig' {Maybe Bool
enableAnswerMachineDetection :: Maybe Bool
awaitAnswerMachinePrompt :: Maybe Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
awaitAnswerMachinePrompt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableAnswerMachineDetection

instance Prelude.NFData AnswerMachineDetectionConfig where
  rnf :: AnswerMachineDetectionConfig -> ()
rnf AnswerMachineDetectionConfig' {Maybe Bool
enableAnswerMachineDetection :: Maybe Bool
awaitAnswerMachinePrompt :: Maybe Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
awaitAnswerMachinePrompt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableAnswerMachineDetection

instance Data.ToJSON AnswerMachineDetectionConfig where
  toJSON :: AnswerMachineDetectionConfig -> Value
toJSON AnswerMachineDetectionConfig' {Maybe Bool
enableAnswerMachineDetection :: Maybe Bool
awaitAnswerMachinePrompt :: Maybe Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
$sel:awaitAnswerMachinePrompt:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AwaitAnswerMachinePrompt" 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 Bool
awaitAnswerMachinePrompt,
            (Key
"EnableAnswerMachineDetection" 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 Bool
enableAnswerMachineDetection
          ]
      )