{-# 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 #-}
module Amazonka.LexV2Models.Types.PromptSpecification 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.MessageGroup
import Amazonka.LexV2Models.Types.MessageSelectionStrategy
import Amazonka.LexV2Models.Types.PromptAttempt
import Amazonka.LexV2Models.Types.PromptAttemptSpecification
import qualified Amazonka.Prelude as Prelude
data PromptSpecification = PromptSpecification'
{
PromptSpecification -> Maybe Bool
allowInterrupt :: Prelude.Maybe Prelude.Bool,
PromptSpecification -> Maybe MessageSelectionStrategy
messageSelectionStrategy :: Prelude.Maybe MessageSelectionStrategy,
PromptSpecification
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification :: Prelude.Maybe (Prelude.HashMap PromptAttempt PromptAttemptSpecification),
PromptSpecification -> NonEmpty MessageGroup
messageGroups :: Prelude.NonEmpty MessageGroup,
PromptSpecification -> Natural
maxRetries :: Prelude.Natural
}
deriving (PromptSpecification -> PromptSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PromptSpecification -> PromptSpecification -> Bool
$c/= :: PromptSpecification -> PromptSpecification -> Bool
== :: PromptSpecification -> PromptSpecification -> Bool
$c== :: PromptSpecification -> PromptSpecification -> Bool
Prelude.Eq, ReadPrec [PromptSpecification]
ReadPrec PromptSpecification
Int -> ReadS PromptSpecification
ReadS [PromptSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PromptSpecification]
$creadListPrec :: ReadPrec [PromptSpecification]
readPrec :: ReadPrec PromptSpecification
$creadPrec :: ReadPrec PromptSpecification
readList :: ReadS [PromptSpecification]
$creadList :: ReadS [PromptSpecification]
readsPrec :: Int -> ReadS PromptSpecification
$creadsPrec :: Int -> ReadS PromptSpecification
Prelude.Read, Int -> PromptSpecification -> ShowS
[PromptSpecification] -> ShowS
PromptSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PromptSpecification] -> ShowS
$cshowList :: [PromptSpecification] -> ShowS
show :: PromptSpecification -> String
$cshow :: PromptSpecification -> String
showsPrec :: Int -> PromptSpecification -> ShowS
$cshowsPrec :: Int -> PromptSpecification -> ShowS
Prelude.Show, forall x. Rep PromptSpecification x -> PromptSpecification
forall x. PromptSpecification -> Rep PromptSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PromptSpecification x -> PromptSpecification
$cfrom :: forall x. PromptSpecification -> Rep PromptSpecification x
Prelude.Generic)
newPromptSpecification ::
Prelude.NonEmpty MessageGroup ->
Prelude.Natural ->
PromptSpecification
newPromptSpecification :: NonEmpty MessageGroup -> Natural -> PromptSpecification
newPromptSpecification NonEmpty MessageGroup
pMessageGroups_ Natural
pMaxRetries_ =
PromptSpecification'
{ $sel:allowInterrupt:PromptSpecification' :: Maybe Bool
allowInterrupt =
forall a. Maybe a
Prelude.Nothing,
$sel:messageSelectionStrategy:PromptSpecification' :: Maybe MessageSelectionStrategy
messageSelectionStrategy = forall a. Maybe a
Prelude.Nothing,
$sel:promptAttemptsSpecification:PromptSpecification' :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification = forall a. Maybe a
Prelude.Nothing,
$sel:messageGroups:PromptSpecification' :: NonEmpty MessageGroup
messageGroups = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty MessageGroup
pMessageGroups_,
$sel:maxRetries:PromptSpecification' :: Natural
maxRetries = Natural
pMaxRetries_
}
promptSpecification_allowInterrupt :: Lens.Lens' PromptSpecification (Prelude.Maybe Prelude.Bool)
promptSpecification_allowInterrupt :: Lens' PromptSpecification (Maybe Bool)
promptSpecification_allowInterrupt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptSpecification' {Maybe Bool
allowInterrupt :: Maybe Bool
$sel:allowInterrupt:PromptSpecification' :: PromptSpecification -> Maybe Bool
allowInterrupt} -> Maybe Bool
allowInterrupt) (\s :: PromptSpecification
s@PromptSpecification' {} Maybe Bool
a -> PromptSpecification
s {$sel:allowInterrupt:PromptSpecification' :: Maybe Bool
allowInterrupt = Maybe Bool
a} :: PromptSpecification)
promptSpecification_messageSelectionStrategy :: Lens.Lens' PromptSpecification (Prelude.Maybe MessageSelectionStrategy)
promptSpecification_messageSelectionStrategy :: Lens' PromptSpecification (Maybe MessageSelectionStrategy)
promptSpecification_messageSelectionStrategy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptSpecification' {Maybe MessageSelectionStrategy
messageSelectionStrategy :: Maybe MessageSelectionStrategy
$sel:messageSelectionStrategy:PromptSpecification' :: PromptSpecification -> Maybe MessageSelectionStrategy
messageSelectionStrategy} -> Maybe MessageSelectionStrategy
messageSelectionStrategy) (\s :: PromptSpecification
s@PromptSpecification' {} Maybe MessageSelectionStrategy
a -> PromptSpecification
s {$sel:messageSelectionStrategy:PromptSpecification' :: Maybe MessageSelectionStrategy
messageSelectionStrategy = Maybe MessageSelectionStrategy
a} :: PromptSpecification)
promptSpecification_promptAttemptsSpecification :: Lens.Lens' PromptSpecification (Prelude.Maybe (Prelude.HashMap PromptAttempt PromptAttemptSpecification))
promptSpecification_promptAttemptsSpecification :: Lens'
PromptSpecification
(Maybe (HashMap PromptAttempt PromptAttemptSpecification))
promptSpecification_promptAttemptsSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptSpecification' {Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
$sel:promptAttemptsSpecification:PromptSpecification' :: PromptSpecification
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification} -> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification) (\s :: PromptSpecification
s@PromptSpecification' {} Maybe (HashMap PromptAttempt PromptAttemptSpecification)
a -> PromptSpecification
s {$sel:promptAttemptsSpecification:PromptSpecification' :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification = Maybe (HashMap PromptAttempt PromptAttemptSpecification)
a} :: PromptSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
promptSpecification_messageGroups :: Lens.Lens' PromptSpecification (Prelude.NonEmpty MessageGroup)
promptSpecification_messageGroups :: Lens' PromptSpecification (NonEmpty MessageGroup)
promptSpecification_messageGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptSpecification' {NonEmpty MessageGroup
messageGroups :: NonEmpty MessageGroup
$sel:messageGroups:PromptSpecification' :: PromptSpecification -> NonEmpty MessageGroup
messageGroups} -> NonEmpty MessageGroup
messageGroups) (\s :: PromptSpecification
s@PromptSpecification' {} NonEmpty MessageGroup
a -> PromptSpecification
s {$sel:messageGroups:PromptSpecification' :: NonEmpty MessageGroup
messageGroups = NonEmpty MessageGroup
a} :: PromptSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
promptSpecification_maxRetries :: Lens.Lens' PromptSpecification Prelude.Natural
promptSpecification_maxRetries :: Lens' PromptSpecification Natural
promptSpecification_maxRetries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromptSpecification' {Natural
maxRetries :: Natural
$sel:maxRetries:PromptSpecification' :: PromptSpecification -> Natural
maxRetries} -> Natural
maxRetries) (\s :: PromptSpecification
s@PromptSpecification' {} Natural
a -> PromptSpecification
s {$sel:maxRetries:PromptSpecification' :: Natural
maxRetries = Natural
a} :: PromptSpecification)
instance Data.FromJSON PromptSpecification where
parseJSON :: Value -> Parser PromptSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PromptSpecification"
( \Object
x ->
Maybe Bool
-> Maybe MessageSelectionStrategy
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
-> NonEmpty MessageGroup
-> Natural
-> PromptSpecification
PromptSpecification'
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
"messageSelectionStrategy")
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
"promptAttemptsSpecification"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
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
"messageGroups")
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
"maxRetries")
)
instance Prelude.Hashable PromptSpecification where
hashWithSalt :: Int -> PromptSpecification -> Int
hashWithSalt Int
_salt PromptSpecification' {Natural
Maybe Bool
Maybe (HashMap PromptAttempt PromptAttemptSpecification)
Maybe MessageSelectionStrategy
NonEmpty MessageGroup
maxRetries :: Natural
messageGroups :: NonEmpty MessageGroup
promptAttemptsSpecification :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
messageSelectionStrategy :: Maybe MessageSelectionStrategy
allowInterrupt :: Maybe Bool
$sel:maxRetries:PromptSpecification' :: PromptSpecification -> Natural
$sel:messageGroups:PromptSpecification' :: PromptSpecification -> NonEmpty MessageGroup
$sel:promptAttemptsSpecification:PromptSpecification' :: PromptSpecification
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
$sel:messageSelectionStrategy:PromptSpecification' :: PromptSpecification -> Maybe MessageSelectionStrategy
$sel:allowInterrupt:PromptSpecification' :: PromptSpecification -> 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 MessageSelectionStrategy
messageSelectionStrategy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty MessageGroup
messageGroups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxRetries
instance Prelude.NFData PromptSpecification where
rnf :: PromptSpecification -> ()
rnf PromptSpecification' {Natural
Maybe Bool
Maybe (HashMap PromptAttempt PromptAttemptSpecification)
Maybe MessageSelectionStrategy
NonEmpty MessageGroup
maxRetries :: Natural
messageGroups :: NonEmpty MessageGroup
promptAttemptsSpecification :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
messageSelectionStrategy :: Maybe MessageSelectionStrategy
allowInterrupt :: Maybe Bool
$sel:maxRetries:PromptSpecification' :: PromptSpecification -> Natural
$sel:messageGroups:PromptSpecification' :: PromptSpecification -> NonEmpty MessageGroup
$sel:promptAttemptsSpecification:PromptSpecification' :: PromptSpecification
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
$sel:messageSelectionStrategy:PromptSpecification' :: PromptSpecification -> Maybe MessageSelectionStrategy
$sel:allowInterrupt:PromptSpecification' :: PromptSpecification -> 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 MessageSelectionStrategy
messageSelectionStrategy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty MessageGroup
messageGroups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maxRetries
instance Data.ToJSON PromptSpecification where
toJSON :: PromptSpecification -> Value
toJSON PromptSpecification' {Natural
Maybe Bool
Maybe (HashMap PromptAttempt PromptAttemptSpecification)
Maybe MessageSelectionStrategy
NonEmpty MessageGroup
maxRetries :: Natural
messageGroups :: NonEmpty MessageGroup
promptAttemptsSpecification :: Maybe (HashMap PromptAttempt PromptAttemptSpecification)
messageSelectionStrategy :: Maybe MessageSelectionStrategy
allowInterrupt :: Maybe Bool
$sel:maxRetries:PromptSpecification' :: PromptSpecification -> Natural
$sel:messageGroups:PromptSpecification' :: PromptSpecification -> NonEmpty MessageGroup
$sel:promptAttemptsSpecification:PromptSpecification' :: PromptSpecification
-> Maybe (HashMap PromptAttempt PromptAttemptSpecification)
$sel:messageSelectionStrategy:PromptSpecification' :: PromptSpecification -> Maybe MessageSelectionStrategy
$sel:allowInterrupt:PromptSpecification' :: PromptSpecification -> 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
"messageSelectionStrategy" 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 MessageSelectionStrategy
messageSelectionStrategy,
(Key
"promptAttemptsSpecification" 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 (HashMap PromptAttempt PromptAttemptSpecification)
promptAttemptsSpecification,
forall a. a -> Maybe a
Prelude.Just (Key
"messageGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty MessageGroup
messageGroups),
forall a. a -> Maybe a
Prelude.Just (Key
"maxRetries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxRetries)
]
)