{-# 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.LexModels.Types.FollowUpPrompt where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.Prompt
import Amazonka.LexModels.Types.Statement
import qualified Amazonka.Prelude as Prelude
data FollowUpPrompt = FollowUpPrompt'
{
FollowUpPrompt -> Prompt
prompt :: Prompt,
FollowUpPrompt -> Statement
rejectionStatement :: Statement
}
deriving (FollowUpPrompt -> FollowUpPrompt -> Bool
(FollowUpPrompt -> FollowUpPrompt -> Bool)
-> (FollowUpPrompt -> FollowUpPrompt -> Bool) -> Eq FollowUpPrompt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FollowUpPrompt -> FollowUpPrompt -> Bool
$c/= :: FollowUpPrompt -> FollowUpPrompt -> Bool
== :: FollowUpPrompt -> FollowUpPrompt -> Bool
$c== :: FollowUpPrompt -> FollowUpPrompt -> Bool
Prelude.Eq, ReadPrec [FollowUpPrompt]
ReadPrec FollowUpPrompt
Int -> ReadS FollowUpPrompt
ReadS [FollowUpPrompt]
(Int -> ReadS FollowUpPrompt)
-> ReadS [FollowUpPrompt]
-> ReadPrec FollowUpPrompt
-> ReadPrec [FollowUpPrompt]
-> Read FollowUpPrompt
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FollowUpPrompt]
$creadListPrec :: ReadPrec [FollowUpPrompt]
readPrec :: ReadPrec FollowUpPrompt
$creadPrec :: ReadPrec FollowUpPrompt
readList :: ReadS [FollowUpPrompt]
$creadList :: ReadS [FollowUpPrompt]
readsPrec :: Int -> ReadS FollowUpPrompt
$creadsPrec :: Int -> ReadS FollowUpPrompt
Prelude.Read, Int -> FollowUpPrompt -> ShowS
[FollowUpPrompt] -> ShowS
FollowUpPrompt -> String
(Int -> FollowUpPrompt -> ShowS)
-> (FollowUpPrompt -> String)
-> ([FollowUpPrompt] -> ShowS)
-> Show FollowUpPrompt
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FollowUpPrompt] -> ShowS
$cshowList :: [FollowUpPrompt] -> ShowS
show :: FollowUpPrompt -> String
$cshow :: FollowUpPrompt -> String
showsPrec :: Int -> FollowUpPrompt -> ShowS
$cshowsPrec :: Int -> FollowUpPrompt -> ShowS
Prelude.Show, (forall x. FollowUpPrompt -> Rep FollowUpPrompt x)
-> (forall x. Rep FollowUpPrompt x -> FollowUpPrompt)
-> Generic FollowUpPrompt
forall x. Rep FollowUpPrompt x -> FollowUpPrompt
forall x. FollowUpPrompt -> Rep FollowUpPrompt x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FollowUpPrompt x -> FollowUpPrompt
$cfrom :: forall x. FollowUpPrompt -> Rep FollowUpPrompt x
Prelude.Generic)
newFollowUpPrompt ::
Prompt ->
Statement ->
FollowUpPrompt
newFollowUpPrompt :: Prompt -> Statement -> FollowUpPrompt
newFollowUpPrompt Prompt
pPrompt_ Statement
pRejectionStatement_ =
FollowUpPrompt' :: Prompt -> Statement -> FollowUpPrompt
FollowUpPrompt'
{ $sel:prompt:FollowUpPrompt' :: Prompt
prompt = Prompt
pPrompt_,
$sel:rejectionStatement:FollowUpPrompt' :: Statement
rejectionStatement = Statement
pRejectionStatement_
}
followUpPrompt_prompt :: Lens.Lens' FollowUpPrompt Prompt
followUpPrompt_prompt :: (Prompt -> f Prompt) -> FollowUpPrompt -> f FollowUpPrompt
followUpPrompt_prompt = (FollowUpPrompt -> Prompt)
-> (FollowUpPrompt -> Prompt -> FollowUpPrompt)
-> Lens FollowUpPrompt FollowUpPrompt Prompt Prompt
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FollowUpPrompt' {Prompt
prompt :: Prompt
$sel:prompt:FollowUpPrompt' :: FollowUpPrompt -> Prompt
prompt} -> Prompt
prompt) (\s :: FollowUpPrompt
s@FollowUpPrompt' {} Prompt
a -> FollowUpPrompt
s {$sel:prompt:FollowUpPrompt' :: Prompt
prompt = Prompt
a} :: FollowUpPrompt)
followUpPrompt_rejectionStatement :: Lens.Lens' FollowUpPrompt Statement
followUpPrompt_rejectionStatement :: (Statement -> f Statement) -> FollowUpPrompt -> f FollowUpPrompt
followUpPrompt_rejectionStatement = (FollowUpPrompt -> Statement)
-> (FollowUpPrompt -> Statement -> FollowUpPrompt)
-> Lens FollowUpPrompt FollowUpPrompt Statement Statement
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FollowUpPrompt' {Statement
rejectionStatement :: Statement
$sel:rejectionStatement:FollowUpPrompt' :: FollowUpPrompt -> Statement
rejectionStatement} -> Statement
rejectionStatement) (\s :: FollowUpPrompt
s@FollowUpPrompt' {} Statement
a -> FollowUpPrompt
s {$sel:rejectionStatement:FollowUpPrompt' :: Statement
rejectionStatement = Statement
a} :: FollowUpPrompt)
instance Core.FromJSON FollowUpPrompt where
parseJSON :: Value -> Parser FollowUpPrompt
parseJSON =
String
-> (Object -> Parser FollowUpPrompt)
-> Value
-> Parser FollowUpPrompt
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FollowUpPrompt"
( \Object
x ->
Prompt -> Statement -> FollowUpPrompt
FollowUpPrompt'
(Prompt -> Statement -> FollowUpPrompt)
-> Parser Prompt -> Parser (Statement -> FollowUpPrompt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Prompt
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"prompt")
Parser (Statement -> FollowUpPrompt)
-> Parser Statement -> Parser FollowUpPrompt
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Statement
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"rejectionStatement")
)
instance Prelude.Hashable FollowUpPrompt
instance Prelude.NFData FollowUpPrompt
instance Core.ToJSON FollowUpPrompt where
toJSON :: FollowUpPrompt -> Value
toJSON FollowUpPrompt' {Prompt
Statement
rejectionStatement :: Statement
prompt :: Prompt
$sel:rejectionStatement:FollowUpPrompt' :: FollowUpPrompt -> Statement
$sel:prompt:FollowUpPrompt' :: FollowUpPrompt -> Prompt
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"prompt" Text -> Prompt -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Prompt
prompt),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"rejectionStatement" Text -> Statement -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Statement
rejectionStatement)
]
)