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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.AllowedInputTypes
import Amazonka.LexV2Models.Types.AudioAndDTMFInputSpecification
import Amazonka.LexV2Models.Types.TextInputSpecification
import qualified Amazonka.Prelude as Prelude

-- | Specifies the settings on a prompt attempt.
--
-- /See:/ 'newPromptAttemptSpecification' smart constructor.
data PromptAttemptSpecification = PromptAttemptSpecification'
  { -- | Indicates whether the user can interrupt a speech prompt attempt from
    -- the bot.
    PromptAttemptSpecification -> Maybe Bool
allowInterrupt :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the settings on audio and DTMF input.
    PromptAttemptSpecification -> Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification :: Prelude.Maybe AudioAndDTMFInputSpecification,
    -- | Specifies the settings on text input.
    PromptAttemptSpecification -> Maybe TextInputSpecification
textInputSpecification :: Prelude.Maybe TextInputSpecification,
    -- | Indicates the allowed input types of the prompt attempt.
    PromptAttemptSpecification -> AllowedInputTypes
allowedInputTypes :: AllowedInputTypes
  }
  deriving (PromptAttemptSpecification -> PromptAttemptSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PromptAttemptSpecification -> PromptAttemptSpecification -> Bool
$c/= :: PromptAttemptSpecification -> PromptAttemptSpecification -> Bool
== :: PromptAttemptSpecification -> PromptAttemptSpecification -> Bool
$c== :: PromptAttemptSpecification -> PromptAttemptSpecification -> Bool
Prelude.Eq, ReadPrec [PromptAttemptSpecification]
ReadPrec PromptAttemptSpecification
Int -> ReadS PromptAttemptSpecification
ReadS [PromptAttemptSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PromptAttemptSpecification]
$creadListPrec :: ReadPrec [PromptAttemptSpecification]
readPrec :: ReadPrec PromptAttemptSpecification
$creadPrec :: ReadPrec PromptAttemptSpecification
readList :: ReadS [PromptAttemptSpecification]
$creadList :: ReadS [PromptAttemptSpecification]
readsPrec :: Int -> ReadS PromptAttemptSpecification
$creadsPrec :: Int -> ReadS PromptAttemptSpecification
Prelude.Read, Int -> PromptAttemptSpecification -> ShowS
[PromptAttemptSpecification] -> ShowS
PromptAttemptSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PromptAttemptSpecification] -> ShowS
$cshowList :: [PromptAttemptSpecification] -> ShowS
show :: PromptAttemptSpecification -> String
$cshow :: PromptAttemptSpecification -> String
showsPrec :: Int -> PromptAttemptSpecification -> ShowS
$cshowsPrec :: Int -> PromptAttemptSpecification -> ShowS
Prelude.Show, forall x.
Rep PromptAttemptSpecification x -> PromptAttemptSpecification
forall x.
PromptAttemptSpecification -> Rep PromptAttemptSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PromptAttemptSpecification x -> PromptAttemptSpecification
$cfrom :: forall x.
PromptAttemptSpecification -> Rep PromptAttemptSpecification x
Prelude.Generic)

-- |
-- Create a value of 'PromptAttemptSpecification' 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:
--
-- 'allowInterrupt', 'promptAttemptSpecification_allowInterrupt' - Indicates whether the user can interrupt a speech prompt attempt from
-- the bot.
--
-- 'audioAndDTMFInputSpecification', 'promptAttemptSpecification_audioAndDTMFInputSpecification' - Specifies the settings on audio and DTMF input.
--
-- 'textInputSpecification', 'promptAttemptSpecification_textInputSpecification' - Specifies the settings on text input.
--
-- 'allowedInputTypes', 'promptAttemptSpecification_allowedInputTypes' - Indicates the allowed input types of the prompt attempt.
newPromptAttemptSpecification ::
  -- | 'allowedInputTypes'
  AllowedInputTypes ->
  PromptAttemptSpecification
newPromptAttemptSpecification :: AllowedInputTypes -> PromptAttemptSpecification
newPromptAttemptSpecification AllowedInputTypes
pAllowedInputTypes_ =
  PromptAttemptSpecification'
    { $sel:allowInterrupt:PromptAttemptSpecification' :: Maybe Bool
allowInterrupt =
        forall a. Maybe a
Prelude.Nothing,
      $sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:textInputSpecification:PromptAttemptSpecification' :: Maybe TextInputSpecification
textInputSpecification = forall a. Maybe a
Prelude.Nothing,
      $sel:allowedInputTypes:PromptAttemptSpecification' :: AllowedInputTypes
allowedInputTypes = AllowedInputTypes
pAllowedInputTypes_
    }

-- | Indicates whether the user can interrupt a speech prompt attempt from
-- the bot.
promptAttemptSpecification_allowInterrupt :: Lens.Lens' PromptAttemptSpecification (Prelude.Maybe Prelude.Bool)
promptAttemptSpecification_allowInterrupt :: Lens' PromptAttemptSpecification (Maybe Bool)
promptAttemptSpecification_allowInterrupt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptAttemptSpecification' {Maybe Bool
allowInterrupt :: Maybe Bool
$sel:allowInterrupt:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe Bool
allowInterrupt} -> Maybe Bool
allowInterrupt) (\s :: PromptAttemptSpecification
s@PromptAttemptSpecification' {} Maybe Bool
a -> PromptAttemptSpecification
s {$sel:allowInterrupt:PromptAttemptSpecification' :: Maybe Bool
allowInterrupt = Maybe Bool
a} :: PromptAttemptSpecification)

-- | Specifies the settings on audio and DTMF input.
promptAttemptSpecification_audioAndDTMFInputSpecification :: Lens.Lens' PromptAttemptSpecification (Prelude.Maybe AudioAndDTMFInputSpecification)
promptAttemptSpecification_audioAndDTMFInputSpecification :: Lens'
  PromptAttemptSpecification (Maybe AudioAndDTMFInputSpecification)
promptAttemptSpecification_audioAndDTMFInputSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptAttemptSpecification' {Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification :: Maybe AudioAndDTMFInputSpecification
$sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification} -> Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification) (\s :: PromptAttemptSpecification
s@PromptAttemptSpecification' {} Maybe AudioAndDTMFInputSpecification
a -> PromptAttemptSpecification
s {$sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification = Maybe AudioAndDTMFInputSpecification
a} :: PromptAttemptSpecification)

-- | Specifies the settings on text input.
promptAttemptSpecification_textInputSpecification :: Lens.Lens' PromptAttemptSpecification (Prelude.Maybe TextInputSpecification)
promptAttemptSpecification_textInputSpecification :: Lens' PromptAttemptSpecification (Maybe TextInputSpecification)
promptAttemptSpecification_textInputSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptAttemptSpecification' {Maybe TextInputSpecification
textInputSpecification :: Maybe TextInputSpecification
$sel:textInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe TextInputSpecification
textInputSpecification} -> Maybe TextInputSpecification
textInputSpecification) (\s :: PromptAttemptSpecification
s@PromptAttemptSpecification' {} Maybe TextInputSpecification
a -> PromptAttemptSpecification
s {$sel:textInputSpecification:PromptAttemptSpecification' :: Maybe TextInputSpecification
textInputSpecification = Maybe TextInputSpecification
a} :: PromptAttemptSpecification)

-- | Indicates the allowed input types of the prompt attempt.
promptAttemptSpecification_allowedInputTypes :: Lens.Lens' PromptAttemptSpecification AllowedInputTypes
promptAttemptSpecification_allowedInputTypes :: Lens' PromptAttemptSpecification AllowedInputTypes
promptAttemptSpecification_allowedInputTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptAttemptSpecification' {AllowedInputTypes
allowedInputTypes :: AllowedInputTypes
$sel:allowedInputTypes:PromptAttemptSpecification' :: PromptAttemptSpecification -> AllowedInputTypes
allowedInputTypes} -> AllowedInputTypes
allowedInputTypes) (\s :: PromptAttemptSpecification
s@PromptAttemptSpecification' {} AllowedInputTypes
a -> PromptAttemptSpecification
s {$sel:allowedInputTypes:PromptAttemptSpecification' :: AllowedInputTypes
allowedInputTypes = AllowedInputTypes
a} :: PromptAttemptSpecification)

instance Data.FromJSON PromptAttemptSpecification where
  parseJSON :: Value -> Parser PromptAttemptSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PromptAttemptSpecification"
      ( \Object
x ->
          Maybe Bool
-> Maybe AudioAndDTMFInputSpecification
-> Maybe TextInputSpecification
-> AllowedInputTypes
-> PromptAttemptSpecification
PromptAttemptSpecification'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"allowInterrupt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"audioAndDTMFInputSpecification")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"textInputSpecification")
            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
"allowedInputTypes")
      )

instance Prelude.Hashable PromptAttemptSpecification where
  hashWithSalt :: Int -> PromptAttemptSpecification -> Int
hashWithSalt Int
_salt PromptAttemptSpecification' {Maybe Bool
Maybe AudioAndDTMFInputSpecification
Maybe TextInputSpecification
AllowedInputTypes
allowedInputTypes :: AllowedInputTypes
textInputSpecification :: Maybe TextInputSpecification
audioAndDTMFInputSpecification :: Maybe AudioAndDTMFInputSpecification
allowInterrupt :: Maybe Bool
$sel:allowedInputTypes:PromptAttemptSpecification' :: PromptAttemptSpecification -> AllowedInputTypes
$sel:textInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe TextInputSpecification
$sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe AudioAndDTMFInputSpecification
$sel:allowInterrupt:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowInterrupt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TextInputSpecification
textInputSpecification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AllowedInputTypes
allowedInputTypes

instance Prelude.NFData PromptAttemptSpecification where
  rnf :: PromptAttemptSpecification -> ()
rnf PromptAttemptSpecification' {Maybe Bool
Maybe AudioAndDTMFInputSpecification
Maybe TextInputSpecification
AllowedInputTypes
allowedInputTypes :: AllowedInputTypes
textInputSpecification :: Maybe TextInputSpecification
audioAndDTMFInputSpecification :: Maybe AudioAndDTMFInputSpecification
allowInterrupt :: Maybe Bool
$sel:allowedInputTypes:PromptAttemptSpecification' :: PromptAttemptSpecification -> AllowedInputTypes
$sel:textInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe TextInputSpecification
$sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe AudioAndDTMFInputSpecification
$sel:allowInterrupt:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowInterrupt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TextInputSpecification
textInputSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AllowedInputTypes
allowedInputTypes

instance Data.ToJSON PromptAttemptSpecification where
  toJSON :: PromptAttemptSpecification -> Value
toJSON PromptAttemptSpecification' {Maybe Bool
Maybe AudioAndDTMFInputSpecification
Maybe TextInputSpecification
AllowedInputTypes
allowedInputTypes :: AllowedInputTypes
textInputSpecification :: Maybe TextInputSpecification
audioAndDTMFInputSpecification :: Maybe AudioAndDTMFInputSpecification
allowInterrupt :: Maybe Bool
$sel:allowedInputTypes:PromptAttemptSpecification' :: PromptAttemptSpecification -> AllowedInputTypes
$sel:textInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe TextInputSpecification
$sel:audioAndDTMFInputSpecification:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe AudioAndDTMFInputSpecification
$sel:allowInterrupt:PromptAttemptSpecification' :: PromptAttemptSpecification -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"allowInterrupt" 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
allowInterrupt,
            (Key
"audioAndDTMFInputSpecification" 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 AudioAndDTMFInputSpecification
audioAndDTMFInputSpecification,
            (Key
"textInputSpecification" 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 TextInputSpecification
textInputSpecification,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"allowedInputTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AllowedInputTypes
allowedInputTypes)
          ]
      )