{-# 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.LexRuntime.Types.DialogAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexRuntime.Types.DialogActionType
import Amazonka.LexRuntime.Types.FulfillmentState
import Amazonka.LexRuntime.Types.MessageFormatType
import qualified Amazonka.Prelude as Prelude
data DialogAction = DialogAction'
{
DialogAction -> Maybe (Sensitive (HashMap Text Text))
slots :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
DialogAction -> Maybe Text
intentName :: Prelude.Maybe Prelude.Text,
DialogAction -> Maybe FulfillmentState
fulfillmentState :: Prelude.Maybe FulfillmentState,
DialogAction -> Maybe MessageFormatType
messageFormat :: Prelude.Maybe MessageFormatType,
DialogAction -> Maybe (Sensitive Text)
message :: Prelude.Maybe (Core.Sensitive Prelude.Text),
DialogAction -> Maybe Text
slotToElicit :: Prelude.Maybe Prelude.Text,
DialogAction -> DialogActionType
type' :: DialogActionType
}
deriving (DialogAction -> DialogAction -> Bool
(DialogAction -> DialogAction -> Bool)
-> (DialogAction -> DialogAction -> Bool) -> Eq DialogAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DialogAction -> DialogAction -> Bool
$c/= :: DialogAction -> DialogAction -> Bool
== :: DialogAction -> DialogAction -> Bool
$c== :: DialogAction -> DialogAction -> Bool
Prelude.Eq, Int -> DialogAction -> ShowS
[DialogAction] -> ShowS
DialogAction -> String
(Int -> DialogAction -> ShowS)
-> (DialogAction -> String)
-> ([DialogAction] -> ShowS)
-> Show DialogAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DialogAction] -> ShowS
$cshowList :: [DialogAction] -> ShowS
show :: DialogAction -> String
$cshow :: DialogAction -> String
showsPrec :: Int -> DialogAction -> ShowS
$cshowsPrec :: Int -> DialogAction -> ShowS
Prelude.Show, (forall x. DialogAction -> Rep DialogAction x)
-> (forall x. Rep DialogAction x -> DialogAction)
-> Generic DialogAction
forall x. Rep DialogAction x -> DialogAction
forall x. DialogAction -> Rep DialogAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DialogAction x -> DialogAction
$cfrom :: forall x. DialogAction -> Rep DialogAction x
Prelude.Generic)
newDialogAction ::
DialogActionType ->
DialogAction
newDialogAction :: DialogActionType -> DialogAction
newDialogAction DialogActionType
pType_ =
DialogAction' :: Maybe (Sensitive (HashMap Text Text))
-> Maybe Text
-> Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction
DialogAction'
{ $sel:slots:DialogAction' :: Maybe (Sensitive (HashMap Text Text))
slots = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
$sel:intentName:DialogAction' :: Maybe Text
intentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fulfillmentState:DialogAction' :: Maybe FulfillmentState
fulfillmentState = Maybe FulfillmentState
forall a. Maybe a
Prelude.Nothing,
$sel:messageFormat:DialogAction' :: Maybe MessageFormatType
messageFormat = Maybe MessageFormatType
forall a. Maybe a
Prelude.Nothing,
$sel:message:DialogAction' :: Maybe (Sensitive Text)
message = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:slotToElicit:DialogAction' :: Maybe Text
slotToElicit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':DialogAction' :: DialogActionType
type' = DialogActionType
pType_
}
dialogAction_slots :: Lens.Lens' DialogAction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dialogAction_slots :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DialogAction -> f DialogAction
dialogAction_slots = (DialogAction -> Maybe (Sensitive (HashMap Text Text)))
-> (DialogAction
-> Maybe (Sensitive (HashMap Text Text)) -> DialogAction)
-> Lens
DialogAction
DialogAction
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (HashMap Text Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe (Sensitive (HashMap Text Text))
slots :: Maybe (Sensitive (HashMap Text Text))
$sel:slots:DialogAction' :: DialogAction -> Maybe (Sensitive (HashMap Text Text))
slots} -> Maybe (Sensitive (HashMap Text Text))
slots) (\s :: DialogAction
s@DialogAction' {} Maybe (Sensitive (HashMap Text Text))
a -> DialogAction
s {$sel:slots:DialogAction' :: Maybe (Sensitive (HashMap Text Text))
slots = Maybe (Sensitive (HashMap Text Text))
a} :: DialogAction) ((Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> DialogAction -> f DialogAction)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DialogAction
-> f DialogAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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 (AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> (Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text)))
-> AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
dialogAction_intentName :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_intentName :: (Maybe Text -> f (Maybe Text)) -> DialogAction -> f DialogAction
dialogAction_intentName = (DialogAction -> Maybe Text)
-> (DialogAction -> Maybe Text -> DialogAction)
-> Lens DialogAction DialogAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe Text
intentName :: Maybe Text
$sel:intentName:DialogAction' :: DialogAction -> Maybe Text
intentName} -> Maybe Text
intentName) (\s :: DialogAction
s@DialogAction' {} Maybe Text
a -> DialogAction
s {$sel:intentName:DialogAction' :: Maybe Text
intentName = Maybe Text
a} :: DialogAction)
dialogAction_fulfillmentState :: Lens.Lens' DialogAction (Prelude.Maybe FulfillmentState)
dialogAction_fulfillmentState :: (Maybe FulfillmentState -> f (Maybe FulfillmentState))
-> DialogAction -> f DialogAction
dialogAction_fulfillmentState = (DialogAction -> Maybe FulfillmentState)
-> (DialogAction -> Maybe FulfillmentState -> DialogAction)
-> Lens
DialogAction
DialogAction
(Maybe FulfillmentState)
(Maybe FulfillmentState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe FulfillmentState
fulfillmentState :: Maybe FulfillmentState
$sel:fulfillmentState:DialogAction' :: DialogAction -> Maybe FulfillmentState
fulfillmentState} -> Maybe FulfillmentState
fulfillmentState) (\s :: DialogAction
s@DialogAction' {} Maybe FulfillmentState
a -> DialogAction
s {$sel:fulfillmentState:DialogAction' :: Maybe FulfillmentState
fulfillmentState = Maybe FulfillmentState
a} :: DialogAction)
dialogAction_messageFormat :: Lens.Lens' DialogAction (Prelude.Maybe MessageFormatType)
dialogAction_messageFormat :: (Maybe MessageFormatType -> f (Maybe MessageFormatType))
-> DialogAction -> f DialogAction
dialogAction_messageFormat = (DialogAction -> Maybe MessageFormatType)
-> (DialogAction -> Maybe MessageFormatType -> DialogAction)
-> Lens
DialogAction
DialogAction
(Maybe MessageFormatType)
(Maybe MessageFormatType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe MessageFormatType
messageFormat :: Maybe MessageFormatType
$sel:messageFormat:DialogAction' :: DialogAction -> Maybe MessageFormatType
messageFormat} -> Maybe MessageFormatType
messageFormat) (\s :: DialogAction
s@DialogAction' {} Maybe MessageFormatType
a -> DialogAction
s {$sel:messageFormat:DialogAction' :: Maybe MessageFormatType
messageFormat = Maybe MessageFormatType
a} :: DialogAction)
dialogAction_message :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_message :: (Maybe Text -> f (Maybe Text)) -> DialogAction -> f DialogAction
dialogAction_message = (DialogAction -> Maybe (Sensitive Text))
-> (DialogAction -> Maybe (Sensitive Text) -> DialogAction)
-> Lens
DialogAction
DialogAction
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe (Sensitive Text)
message :: Maybe (Sensitive Text)
$sel:message:DialogAction' :: DialogAction -> Maybe (Sensitive Text)
message} -> Maybe (Sensitive Text)
message) (\s :: DialogAction
s@DialogAction' {} Maybe (Sensitive Text)
a -> DialogAction
s {$sel:message:DialogAction' :: Maybe (Sensitive Text)
message = Maybe (Sensitive Text)
a} :: DialogAction) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> DialogAction -> f DialogAction)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DialogAction
-> f DialogAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
dialogAction_slotToElicit :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_slotToElicit :: (Maybe Text -> f (Maybe Text)) -> DialogAction -> f DialogAction
dialogAction_slotToElicit = (DialogAction -> Maybe Text)
-> (DialogAction -> Maybe Text -> DialogAction)
-> Lens DialogAction DialogAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {Maybe Text
slotToElicit :: Maybe Text
$sel:slotToElicit:DialogAction' :: DialogAction -> Maybe Text
slotToElicit} -> Maybe Text
slotToElicit) (\s :: DialogAction
s@DialogAction' {} Maybe Text
a -> DialogAction
s {$sel:slotToElicit:DialogAction' :: Maybe Text
slotToElicit = Maybe Text
a} :: DialogAction)
dialogAction_type :: Lens.Lens' DialogAction DialogActionType
dialogAction_type :: (DialogActionType -> f DialogActionType)
-> DialogAction -> f DialogAction
dialogAction_type = (DialogAction -> DialogActionType)
-> (DialogAction -> DialogActionType -> DialogAction)
-> Lens DialogAction DialogAction DialogActionType DialogActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogAction' {DialogActionType
type' :: DialogActionType
$sel:type':DialogAction' :: DialogAction -> DialogActionType
type'} -> DialogActionType
type') (\s :: DialogAction
s@DialogAction' {} DialogActionType
a -> DialogAction
s {$sel:type':DialogAction' :: DialogActionType
type' = DialogActionType
a} :: DialogAction)
instance Core.FromJSON DialogAction where
parseJSON :: Value -> Parser DialogAction
parseJSON =
String
-> (Object -> Parser DialogAction) -> Value -> Parser DialogAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DialogAction"
( \Object
x ->
Maybe (Sensitive (HashMap Text Text))
-> Maybe Text
-> Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction
DialogAction'
(Maybe (Sensitive (HashMap Text Text))
-> Maybe Text
-> Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
-> Parser (Maybe (Sensitive (HashMap Text Text)))
-> Parser
(Maybe Text
-> Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe (Sensitive (HashMap Text Text))))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"slots" Parser (Maybe (Maybe (Sensitive (HashMap Text Text))))
-> Maybe (Sensitive (HashMap Text Text))
-> Parser (Maybe (Sensitive (HashMap Text Text)))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (Sensitive (HashMap Text Text))
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
-> Parser (Maybe Text)
-> Parser
(Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"intentName")
Parser
(Maybe FulfillmentState
-> Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
-> Parser (Maybe FulfillmentState)
-> Parser
(Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FulfillmentState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fulfillmentState")
Parser
(Maybe MessageFormatType
-> Maybe (Sensitive Text)
-> Maybe Text
-> DialogActionType
-> DialogAction)
-> Parser (Maybe MessageFormatType)
-> Parser
(Maybe (Sensitive Text)
-> Maybe Text -> DialogActionType -> DialogAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MessageFormatType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"messageFormat")
Parser
(Maybe (Sensitive Text)
-> Maybe Text -> DialogActionType -> DialogAction)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> DialogActionType -> DialogAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"message")
Parser (Maybe Text -> DialogActionType -> DialogAction)
-> Parser (Maybe Text) -> Parser (DialogActionType -> DialogAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"slotToElicit")
Parser (DialogActionType -> DialogAction)
-> Parser DialogActionType -> Parser DialogAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DialogActionType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable DialogAction
instance Prelude.NFData DialogAction
instance Core.ToJSON DialogAction where
toJSON :: DialogAction -> Value
toJSON DialogAction' {Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive (HashMap Text Text))
Maybe FulfillmentState
Maybe MessageFormatType
DialogActionType
type' :: DialogActionType
slotToElicit :: Maybe Text
message :: Maybe (Sensitive Text)
messageFormat :: Maybe MessageFormatType
fulfillmentState :: Maybe FulfillmentState
intentName :: Maybe Text
slots :: Maybe (Sensitive (HashMap Text Text))
$sel:type':DialogAction' :: DialogAction -> DialogActionType
$sel:slotToElicit:DialogAction' :: DialogAction -> Maybe Text
$sel:message:DialogAction' :: DialogAction -> Maybe (Sensitive Text)
$sel:messageFormat:DialogAction' :: DialogAction -> Maybe MessageFormatType
$sel:fulfillmentState:DialogAction' :: DialogAction -> Maybe FulfillmentState
$sel:intentName:DialogAction' :: DialogAction -> Maybe Text
$sel:slots:DialogAction' :: DialogAction -> Maybe (Sensitive (HashMap Text Text))
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"slots" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive (HashMap Text Text) -> Pair)
-> Maybe (Sensitive (HashMap Text Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
slots,
(Text
"intentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
intentName,
(Text
"fulfillmentState" Text -> FulfillmentState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FulfillmentState -> Pair) -> Maybe FulfillmentState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FulfillmentState
fulfillmentState,
(Text
"messageFormat" Text -> MessageFormatType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MessageFormatType -> Pair)
-> Maybe MessageFormatType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MessageFormatType
messageFormat,
(Text
"message" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
message,
(Text
"slotToElicit" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
slotToElicit,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> DialogActionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DialogActionType
type')
]
)