{-# 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.LexV2Models.Types.DTMFSpecification
-- 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.LexV2Models.Types.DTMFSpecification 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

-- | Specifies the DTMF input specifications.
--
-- /See:/ 'newDTMFSpecification' smart constructor.
data DTMFSpecification = DTMFSpecification'
  { -- | The maximum number of DTMF digits allowed in an utterance.
    DTMFSpecification -> Natural
maxLength :: Prelude.Natural,
    -- | How long the bot should wait after the last DTMF character input before
    -- assuming that the input has concluded.
    DTMFSpecification -> Natural
endTimeoutMs :: Prelude.Natural,
    -- | The DTMF character that clears the accumulated DTMF digits and
    -- immediately ends the input.
    DTMFSpecification -> Text
deletionCharacter :: Prelude.Text,
    -- | The DTMF character that immediately ends input. If the user does not
    -- press this character, the input ends after the end timeout.
    DTMFSpecification -> Text
endCharacter :: Prelude.Text
  }
  deriving (DTMFSpecification -> DTMFSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DTMFSpecification -> DTMFSpecification -> Bool
$c/= :: DTMFSpecification -> DTMFSpecification -> Bool
== :: DTMFSpecification -> DTMFSpecification -> Bool
$c== :: DTMFSpecification -> DTMFSpecification -> Bool
Prelude.Eq, ReadPrec [DTMFSpecification]
ReadPrec DTMFSpecification
Int -> ReadS DTMFSpecification
ReadS [DTMFSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DTMFSpecification]
$creadListPrec :: ReadPrec [DTMFSpecification]
readPrec :: ReadPrec DTMFSpecification
$creadPrec :: ReadPrec DTMFSpecification
readList :: ReadS [DTMFSpecification]
$creadList :: ReadS [DTMFSpecification]
readsPrec :: Int -> ReadS DTMFSpecification
$creadsPrec :: Int -> ReadS DTMFSpecification
Prelude.Read, Int -> DTMFSpecification -> ShowS
[DTMFSpecification] -> ShowS
DTMFSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DTMFSpecification] -> ShowS
$cshowList :: [DTMFSpecification] -> ShowS
show :: DTMFSpecification -> String
$cshow :: DTMFSpecification -> String
showsPrec :: Int -> DTMFSpecification -> ShowS
$cshowsPrec :: Int -> DTMFSpecification -> ShowS
Prelude.Show, forall x. Rep DTMFSpecification x -> DTMFSpecification
forall x. DTMFSpecification -> Rep DTMFSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DTMFSpecification x -> DTMFSpecification
$cfrom :: forall x. DTMFSpecification -> Rep DTMFSpecification x
Prelude.Generic)

-- |
-- Create a value of 'DTMFSpecification' 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:
--
-- 'maxLength', 'dTMFSpecification_maxLength' - The maximum number of DTMF digits allowed in an utterance.
--
-- 'endTimeoutMs', 'dTMFSpecification_endTimeoutMs' - How long the bot should wait after the last DTMF character input before
-- assuming that the input has concluded.
--
-- 'deletionCharacter', 'dTMFSpecification_deletionCharacter' - The DTMF character that clears the accumulated DTMF digits and
-- immediately ends the input.
--
-- 'endCharacter', 'dTMFSpecification_endCharacter' - The DTMF character that immediately ends input. If the user does not
-- press this character, the input ends after the end timeout.
newDTMFSpecification ::
  -- | 'maxLength'
  Prelude.Natural ->
  -- | 'endTimeoutMs'
  Prelude.Natural ->
  -- | 'deletionCharacter'
  Prelude.Text ->
  -- | 'endCharacter'
  Prelude.Text ->
  DTMFSpecification
newDTMFSpecification :: Natural -> Natural -> Text -> Text -> DTMFSpecification
newDTMFSpecification
  Natural
pMaxLength_
  Natural
pEndTimeoutMs_
  Text
pDeletionCharacter_
  Text
pEndCharacter_ =
    DTMFSpecification'
      { $sel:maxLength:DTMFSpecification' :: Natural
maxLength = Natural
pMaxLength_,
        $sel:endTimeoutMs:DTMFSpecification' :: Natural
endTimeoutMs = Natural
pEndTimeoutMs_,
        $sel:deletionCharacter:DTMFSpecification' :: Text
deletionCharacter = Text
pDeletionCharacter_,
        $sel:endCharacter:DTMFSpecification' :: Text
endCharacter = Text
pEndCharacter_
      }

-- | The maximum number of DTMF digits allowed in an utterance.
dTMFSpecification_maxLength :: Lens.Lens' DTMFSpecification Prelude.Natural
dTMFSpecification_maxLength :: Lens' DTMFSpecification Natural
dTMFSpecification_maxLength = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DTMFSpecification' {Natural
maxLength :: Natural
$sel:maxLength:DTMFSpecification' :: DTMFSpecification -> Natural
maxLength} -> Natural
maxLength) (\s :: DTMFSpecification
s@DTMFSpecification' {} Natural
a -> DTMFSpecification
s {$sel:maxLength:DTMFSpecification' :: Natural
maxLength = Natural
a} :: DTMFSpecification)

-- | How long the bot should wait after the last DTMF character input before
-- assuming that the input has concluded.
dTMFSpecification_endTimeoutMs :: Lens.Lens' DTMFSpecification Prelude.Natural
dTMFSpecification_endTimeoutMs :: Lens' DTMFSpecification Natural
dTMFSpecification_endTimeoutMs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DTMFSpecification' {Natural
endTimeoutMs :: Natural
$sel:endTimeoutMs:DTMFSpecification' :: DTMFSpecification -> Natural
endTimeoutMs} -> Natural
endTimeoutMs) (\s :: DTMFSpecification
s@DTMFSpecification' {} Natural
a -> DTMFSpecification
s {$sel:endTimeoutMs:DTMFSpecification' :: Natural
endTimeoutMs = Natural
a} :: DTMFSpecification)

-- | The DTMF character that clears the accumulated DTMF digits and
-- immediately ends the input.
dTMFSpecification_deletionCharacter :: Lens.Lens' DTMFSpecification Prelude.Text
dTMFSpecification_deletionCharacter :: Lens' DTMFSpecification Text
dTMFSpecification_deletionCharacter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DTMFSpecification' {Text
deletionCharacter :: Text
$sel:deletionCharacter:DTMFSpecification' :: DTMFSpecification -> Text
deletionCharacter} -> Text
deletionCharacter) (\s :: DTMFSpecification
s@DTMFSpecification' {} Text
a -> DTMFSpecification
s {$sel:deletionCharacter:DTMFSpecification' :: Text
deletionCharacter = Text
a} :: DTMFSpecification)

-- | The DTMF character that immediately ends input. If the user does not
-- press this character, the input ends after the end timeout.
dTMFSpecification_endCharacter :: Lens.Lens' DTMFSpecification Prelude.Text
dTMFSpecification_endCharacter :: Lens' DTMFSpecification Text
dTMFSpecification_endCharacter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DTMFSpecification' {Text
endCharacter :: Text
$sel:endCharacter:DTMFSpecification' :: DTMFSpecification -> Text
endCharacter} -> Text
endCharacter) (\s :: DTMFSpecification
s@DTMFSpecification' {} Text
a -> DTMFSpecification
s {$sel:endCharacter:DTMFSpecification' :: Text
endCharacter = Text
a} :: DTMFSpecification)

instance Data.FromJSON DTMFSpecification where
  parseJSON :: Value -> Parser DTMFSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DTMFSpecification"
      ( \Object
x ->
          Natural -> Natural -> Text -> Text -> DTMFSpecification
DTMFSpecification'
            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
"maxLength")
            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
"endTimeoutMs")
            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
"deletionCharacter")
            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
"endCharacter")
      )

instance Prelude.Hashable DTMFSpecification where
  hashWithSalt :: Int -> DTMFSpecification -> Int
hashWithSalt Int
_salt DTMFSpecification' {Natural
Text
endCharacter :: Text
deletionCharacter :: Text
endTimeoutMs :: Natural
maxLength :: Natural
$sel:endCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:deletionCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:endTimeoutMs:DTMFSpecification' :: DTMFSpecification -> Natural
$sel:maxLength:DTMFSpecification' :: DTMFSpecification -> Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxLength
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
endTimeoutMs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deletionCharacter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endCharacter

instance Prelude.NFData DTMFSpecification where
  rnf :: DTMFSpecification -> ()
rnf DTMFSpecification' {Natural
Text
endCharacter :: Text
deletionCharacter :: Text
endTimeoutMs :: Natural
maxLength :: Natural
$sel:endCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:deletionCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:endTimeoutMs:DTMFSpecification' :: DTMFSpecification -> Natural
$sel:maxLength:DTMFSpecification' :: DTMFSpecification -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
maxLength
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
endTimeoutMs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deletionCharacter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endCharacter

instance Data.ToJSON DTMFSpecification where
  toJSON :: DTMFSpecification -> Value
toJSON DTMFSpecification' {Natural
Text
endCharacter :: Text
deletionCharacter :: Text
endTimeoutMs :: Natural
maxLength :: Natural
$sel:endCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:deletionCharacter:DTMFSpecification' :: DTMFSpecification -> Text
$sel:endTimeoutMs:DTMFSpecification' :: DTMFSpecification -> Natural
$sel:maxLength:DTMFSpecification' :: DTMFSpecification -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"maxLength" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxLength),
            forall a. a -> Maybe a
Prelude.Just (Key
"endTimeoutMs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
endTimeoutMs),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"deletionCharacter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
deletionCharacter),
            forall a. a -> Maybe a
Prelude.Just (Key
"endCharacter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endCharacter)
          ]
      )