{-# 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.TextInputSpecification
-- 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.TextInputSpecification 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 text input specifications.
--
-- /See:/ 'newTextInputSpecification' smart constructor.
data TextInputSpecification = TextInputSpecification'
  { -- | Time for which a bot waits before re-prompting a customer for text
    -- input.
    TextInputSpecification -> Natural
startTimeoutMs :: Prelude.Natural
  }
  deriving (TextInputSpecification -> TextInputSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextInputSpecification -> TextInputSpecification -> Bool
$c/= :: TextInputSpecification -> TextInputSpecification -> Bool
== :: TextInputSpecification -> TextInputSpecification -> Bool
$c== :: TextInputSpecification -> TextInputSpecification -> Bool
Prelude.Eq, ReadPrec [TextInputSpecification]
ReadPrec TextInputSpecification
Int -> ReadS TextInputSpecification
ReadS [TextInputSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextInputSpecification]
$creadListPrec :: ReadPrec [TextInputSpecification]
readPrec :: ReadPrec TextInputSpecification
$creadPrec :: ReadPrec TextInputSpecification
readList :: ReadS [TextInputSpecification]
$creadList :: ReadS [TextInputSpecification]
readsPrec :: Int -> ReadS TextInputSpecification
$creadsPrec :: Int -> ReadS TextInputSpecification
Prelude.Read, Int -> TextInputSpecification -> ShowS
[TextInputSpecification] -> ShowS
TextInputSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextInputSpecification] -> ShowS
$cshowList :: [TextInputSpecification] -> ShowS
show :: TextInputSpecification -> String
$cshow :: TextInputSpecification -> String
showsPrec :: Int -> TextInputSpecification -> ShowS
$cshowsPrec :: Int -> TextInputSpecification -> ShowS
Prelude.Show, forall x. Rep TextInputSpecification x -> TextInputSpecification
forall x. TextInputSpecification -> Rep TextInputSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextInputSpecification x -> TextInputSpecification
$cfrom :: forall x. TextInputSpecification -> Rep TextInputSpecification x
Prelude.Generic)

-- |
-- Create a value of 'TextInputSpecification' 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:
--
-- 'startTimeoutMs', 'textInputSpecification_startTimeoutMs' - Time for which a bot waits before re-prompting a customer for text
-- input.
newTextInputSpecification ::
  -- | 'startTimeoutMs'
  Prelude.Natural ->
  TextInputSpecification
newTextInputSpecification :: Natural -> TextInputSpecification
newTextInputSpecification Natural
pStartTimeoutMs_ =
  TextInputSpecification'
    { $sel:startTimeoutMs:TextInputSpecification' :: Natural
startTimeoutMs =
        Natural
pStartTimeoutMs_
    }

-- | Time for which a bot waits before re-prompting a customer for text
-- input.
textInputSpecification_startTimeoutMs :: Lens.Lens' TextInputSpecification Prelude.Natural
textInputSpecification_startTimeoutMs :: Lens' TextInputSpecification Natural
textInputSpecification_startTimeoutMs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextInputSpecification' {Natural
startTimeoutMs :: Natural
$sel:startTimeoutMs:TextInputSpecification' :: TextInputSpecification -> Natural
startTimeoutMs} -> Natural
startTimeoutMs) (\s :: TextInputSpecification
s@TextInputSpecification' {} Natural
a -> TextInputSpecification
s {$sel:startTimeoutMs:TextInputSpecification' :: Natural
startTimeoutMs = Natural
a} :: TextInputSpecification)

instance Data.FromJSON TextInputSpecification where
  parseJSON :: Value -> Parser TextInputSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TextInputSpecification"
      ( \Object
x ->
          Natural -> TextInputSpecification
TextInputSpecification'
            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
"startTimeoutMs")
      )

instance Prelude.Hashable TextInputSpecification where
  hashWithSalt :: Int -> TextInputSpecification -> Int
hashWithSalt Int
_salt TextInputSpecification' {Natural
startTimeoutMs :: Natural
$sel:startTimeoutMs:TextInputSpecification' :: TextInputSpecification -> Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
startTimeoutMs

instance Prelude.NFData TextInputSpecification where
  rnf :: TextInputSpecification -> ()
rnf TextInputSpecification' {Natural
startTimeoutMs :: Natural
$sel:startTimeoutMs:TextInputSpecification' :: TextInputSpecification -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
startTimeoutMs

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