{-# 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.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.ConnectCampaigns.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

-- | Answering Machine Detection config
--
-- /See:/ 'newAnswerMachineDetectionConfig' smart constructor.
data AnswerMachineDetectionConfig = AnswerMachineDetectionConfig'
  { -- | Enable or disable answering machine detection
    AnswerMachineDetectionConfig -> Bool
enableAnswerMachineDetection :: 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:
--
-- 'enableAnswerMachineDetection', 'answerMachineDetectionConfig_enableAnswerMachineDetection' - Enable or disable answering machine detection
newAnswerMachineDetectionConfig ::
  -- | 'enableAnswerMachineDetection'
  Prelude.Bool ->
  AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig :: Bool -> AnswerMachineDetectionConfig
newAnswerMachineDetectionConfig
  Bool
pEnableAnswerMachineDetection_ =
    AnswerMachineDetectionConfig'
      { $sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: Bool
enableAnswerMachineDetection =
          Bool
pEnableAnswerMachineDetection_
      }

-- | Enable or disable answering machine detection
answerMachineDetectionConfig_enableAnswerMachineDetection :: Lens.Lens' AnswerMachineDetectionConfig Prelude.Bool
answerMachineDetectionConfig_enableAnswerMachineDetection :: Lens' AnswerMachineDetectionConfig Bool
answerMachineDetectionConfig_enableAnswerMachineDetection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerMachineDetectionConfig' {Bool
enableAnswerMachineDetection :: Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Bool
enableAnswerMachineDetection} -> Bool
enableAnswerMachineDetection) (\s :: AnswerMachineDetectionConfig
s@AnswerMachineDetectionConfig' {} Bool
a -> AnswerMachineDetectionConfig
s {$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: Bool
enableAnswerMachineDetection = Bool
a} :: AnswerMachineDetectionConfig)

instance Data.FromJSON AnswerMachineDetectionConfig where
  parseJSON :: Value -> Parser AnswerMachineDetectionConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnswerMachineDetectionConfig"
      ( \Object
x ->
          Bool -> AnswerMachineDetectionConfig
AnswerMachineDetectionConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enableAnswerMachineDetection")
      )

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

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

instance Data.ToJSON AnswerMachineDetectionConfig where
  toJSON :: AnswerMachineDetectionConfig -> Value
toJSON AnswerMachineDetectionConfig' {Bool
enableAnswerMachineDetection :: Bool
$sel:enableAnswerMachineDetection:AnswerMachineDetectionConfig' :: AnswerMachineDetectionConfig -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"enableAnswerMachineDetection"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enableAnswerMachineDetection
              )
          ]
      )