{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 FulfillmentState
fulfillmentState :: Prelude.Maybe FulfillmentState,
DialogAction -> Maybe Text
intentName :: Prelude.Maybe Prelude.Text,
DialogAction -> Maybe (Sensitive Text)
message :: Prelude.Maybe (Data.Sensitive Prelude.Text),
DialogAction -> Maybe MessageFormatType
messageFormat :: Prelude.Maybe MessageFormatType,
DialogAction -> Maybe Text
slotToElicit :: Prelude.Maybe Prelude.Text,
DialogAction -> Maybe (Sensitive (HashMap Text Text))
slots :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
DialogAction -> DialogActionType
type' :: DialogActionType
}
deriving (DialogAction -> DialogAction -> Bool
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
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. 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'
{ $sel:fulfillmentState:DialogAction' :: Maybe FulfillmentState
fulfillmentState = forall a. Maybe a
Prelude.Nothing,
$sel:intentName:DialogAction' :: Maybe Text
intentName = forall a. Maybe a
Prelude.Nothing,
$sel:message:DialogAction' :: Maybe (Sensitive Text)
message = forall a. Maybe a
Prelude.Nothing,
$sel:messageFormat:DialogAction' :: Maybe MessageFormatType
messageFormat = forall a. Maybe a
Prelude.Nothing,
$sel:slotToElicit:DialogAction' :: Maybe Text
slotToElicit = forall a. Maybe a
Prelude.Nothing,
$sel:slots:DialogAction' :: Maybe (Sensitive (HashMap Text Text))
slots = forall a. Maybe a
Prelude.Nothing,
$sel:type':DialogAction' :: DialogActionType
type' = DialogActionType
pType_
}
dialogAction_fulfillmentState :: Lens.Lens' DialogAction (Prelude.Maybe FulfillmentState)
dialogAction_fulfillmentState :: Lens' DialogAction (Maybe FulfillmentState)
dialogAction_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_intentName :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_intentName :: Lens' DialogAction (Maybe Text)
dialogAction_intentName = 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_message :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_message :: Lens' DialogAction (Maybe Text)
dialogAction_message = 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) 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 a. Iso' (Sensitive a) a
Data._Sensitive
dialogAction_messageFormat :: Lens.Lens' DialogAction (Prelude.Maybe MessageFormatType)
dialogAction_messageFormat :: Lens' DialogAction (Maybe MessageFormatType)
dialogAction_messageFormat = 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_slotToElicit :: Lens.Lens' DialogAction (Prelude.Maybe Prelude.Text)
dialogAction_slotToElicit :: Lens' DialogAction (Maybe Text)
dialogAction_slotToElicit = 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_slots :: Lens.Lens' DialogAction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dialogAction_slots :: Lens' DialogAction (Maybe (HashMap Text Text))
dialogAction_slots = 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) 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 a. Iso' (Sensitive a) a
Data._Sensitive 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)
dialogAction_type :: Lens.Lens' DialogAction DialogActionType
dialogAction_type :: Lens' DialogAction DialogActionType
dialogAction_type = 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 Data.FromJSON DialogAction where
parseJSON :: Value -> Parser DialogAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DialogAction"
( \Object
x ->
Maybe FulfillmentState
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe MessageFormatType
-> Maybe Text
-> Maybe (Sensitive (HashMap Text Text))
-> DialogActionType
-> DialogAction
DialogAction'
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
"fulfillmentState")
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
"intentName")
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
"message")
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
"messageFormat")
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
"slotToElicit")
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
"slots" 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
"type")
)
instance Prelude.Hashable DialogAction where
hashWithSalt :: Int -> DialogAction -> Int
hashWithSalt Int
_salt DialogAction' {Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive (HashMap Text Text))
Maybe FulfillmentState
Maybe MessageFormatType
DialogActionType
type' :: DialogActionType
slots :: Maybe (Sensitive (HashMap Text Text))
slotToElicit :: Maybe Text
messageFormat :: Maybe MessageFormatType
message :: Maybe (Sensitive Text)
intentName :: Maybe Text
fulfillmentState :: Maybe FulfillmentState
$sel:type':DialogAction' :: DialogAction -> DialogActionType
$sel:slots:DialogAction' :: DialogAction -> Maybe (Sensitive (HashMap Text Text))
$sel:slotToElicit:DialogAction' :: DialogAction -> Maybe Text
$sel:messageFormat:DialogAction' :: DialogAction -> Maybe MessageFormatType
$sel:message:DialogAction' :: DialogAction -> Maybe (Sensitive Text)
$sel:intentName:DialogAction' :: DialogAction -> Maybe Text
$sel:fulfillmentState:DialogAction' :: DialogAction -> Maybe FulfillmentState
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FulfillmentState
fulfillmentState
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
intentName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
message
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MessageFormatType
messageFormat
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
slotToElicit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
slots
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DialogActionType
type'
instance Prelude.NFData DialogAction where
rnf :: DialogAction -> ()
rnf DialogAction' {Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive (HashMap Text Text))
Maybe FulfillmentState
Maybe MessageFormatType
DialogActionType
type' :: DialogActionType
slots :: Maybe (Sensitive (HashMap Text Text))
slotToElicit :: Maybe Text
messageFormat :: Maybe MessageFormatType
message :: Maybe (Sensitive Text)
intentName :: Maybe Text
fulfillmentState :: Maybe FulfillmentState
$sel:type':DialogAction' :: DialogAction -> DialogActionType
$sel:slots:DialogAction' :: DialogAction -> Maybe (Sensitive (HashMap Text Text))
$sel:slotToElicit:DialogAction' :: DialogAction -> Maybe Text
$sel:messageFormat:DialogAction' :: DialogAction -> Maybe MessageFormatType
$sel:message:DialogAction' :: DialogAction -> Maybe (Sensitive Text)
$sel:intentName:DialogAction' :: DialogAction -> Maybe Text
$sel:fulfillmentState:DialogAction' :: DialogAction -> Maybe FulfillmentState
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe FulfillmentState
fulfillmentState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
intentName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
message
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MessageFormatType
messageFormat
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
slotToElicit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
slots
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DialogActionType
type'
instance Data.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
slots :: Maybe (Sensitive (HashMap Text Text))
slotToElicit :: Maybe Text
messageFormat :: Maybe MessageFormatType
message :: Maybe (Sensitive Text)
intentName :: Maybe Text
fulfillmentState :: Maybe FulfillmentState
$sel:type':DialogAction' :: DialogAction -> DialogActionType
$sel:slots:DialogAction' :: DialogAction -> Maybe (Sensitive (HashMap Text Text))
$sel:slotToElicit:DialogAction' :: DialogAction -> Maybe Text
$sel:messageFormat:DialogAction' :: DialogAction -> Maybe MessageFormatType
$sel:message:DialogAction' :: DialogAction -> Maybe (Sensitive Text)
$sel:intentName:DialogAction' :: DialogAction -> Maybe Text
$sel:fulfillmentState:DialogAction' :: DialogAction -> Maybe FulfillmentState
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"fulfillmentState" 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 FulfillmentState
fulfillmentState,
(Key
"intentName" 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 Text
intentName,
(Key
"message" 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 (Sensitive Text)
message,
(Key
"messageFormat" 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 MessageFormatType
messageFormat,
(Key
"slotToElicit" 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 Text
slotToElicit,
(Key
"slots" 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 (Sensitive (HashMap Text Text))
slots,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DialogActionType
type')
]
)