{-# 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.LexRuntime.Types.IntentSummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexRuntime.Types.IntentSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexRuntime.Types.ConfirmationStatus
import Amazonka.LexRuntime.Types.DialogActionType
import Amazonka.LexRuntime.Types.FulfillmentState
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the state of an intent. You can use this
-- information to get the current state of an intent so that you can
-- process the intent, or so that you can return the intent to its previous
-- state.
--
-- /See:/ 'newIntentSummary' smart constructor.
data IntentSummary = IntentSummary'
  { -- | A user-defined label that identifies a particular intent. You can use
    -- this label to return to a previous intent.
    --
    -- Use the @checkpointLabelFilter@ parameter of the @GetSessionRequest@
    -- operation to filter the intents returned by the operation to those with
    -- only the specified label.
    IntentSummary -> Maybe Text
checkpointLabel :: Prelude.Maybe Prelude.Text,
    -- | Map of the slots that have been gathered and their values.
    IntentSummary -> Maybe (Sensitive (HashMap Text Text))
slots :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
    -- | The name of the intent.
    IntentSummary -> Maybe Text
intentName :: Prelude.Maybe Prelude.Text,
    -- | The fulfillment state of the intent. The possible values are:
    --
    -- -   @Failed@ - The Lambda function associated with the intent failed to
    --     fulfill the intent.
    --
    -- -   @Fulfilled@ - The intent has fulfilled by the Lambda function
    --     associated with the intent.
    --
    -- -   @ReadyForFulfillment@ - All of the information necessary for the
    --     intent is present and the intent ready to be fulfilled by the client
    --     application.
    IntentSummary -> Maybe FulfillmentState
fulfillmentState :: Prelude.Maybe FulfillmentState,
    -- | The status of the intent after the user responds to the confirmation
    -- prompt. If the user confirms the intent, Amazon Lex sets this field to
    -- @Confirmed@. If the user denies the intent, Amazon Lex sets this value
    -- to @Denied@. The possible values are:
    --
    -- -   @Confirmed@ - The user has responded \"Yes\" to the confirmation
    --     prompt, confirming that the intent is complete and that it is ready
    --     to be fulfilled.
    --
    -- -   @Denied@ - The user has responded \"No\" to the confirmation prompt.
    --
    -- -   @None@ - The user has never been prompted for confirmation; or, the
    --     user was prompted but did not confirm or deny the prompt.
    IntentSummary -> Maybe ConfirmationStatus
confirmationStatus :: Prelude.Maybe ConfirmationStatus,
    -- | The next slot to elicit from the user. If there is not slot to elicit,
    -- the field is blank.
    IntentSummary -> Maybe Text
slotToElicit :: Prelude.Maybe Prelude.Text,
    -- | The next action that the bot should take in its interaction with the
    -- user. The possible values are:
    --
    -- -   @ConfirmIntent@ - The next action is asking the user if the intent
    --     is complete and ready to be fulfilled. This is a yes\/no question
    --     such as \"Place the order?\"
    --
    -- -   @Close@ - Indicates that the there will not be a response from the
    --     user. For example, the statement \"Your order has been placed\" does
    --     not require a response.
    --
    -- -   @ElicitIntent@ - The next action is to determine the intent that the
    --     user wants to fulfill.
    --
    -- -   @ElicitSlot@ - The next action is to elicit a slot value from the
    --     user.
    IntentSummary -> DialogActionType
dialogActionType :: DialogActionType
  }
  deriving (IntentSummary -> IntentSummary -> Bool
(IntentSummary -> IntentSummary -> Bool)
-> (IntentSummary -> IntentSummary -> Bool) -> Eq IntentSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntentSummary -> IntentSummary -> Bool
$c/= :: IntentSummary -> IntentSummary -> Bool
== :: IntentSummary -> IntentSummary -> Bool
$c== :: IntentSummary -> IntentSummary -> Bool
Prelude.Eq, Int -> IntentSummary -> ShowS
[IntentSummary] -> ShowS
IntentSummary -> String
(Int -> IntentSummary -> ShowS)
-> (IntentSummary -> String)
-> ([IntentSummary] -> ShowS)
-> Show IntentSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntentSummary] -> ShowS
$cshowList :: [IntentSummary] -> ShowS
show :: IntentSummary -> String
$cshow :: IntentSummary -> String
showsPrec :: Int -> IntentSummary -> ShowS
$cshowsPrec :: Int -> IntentSummary -> ShowS
Prelude.Show, (forall x. IntentSummary -> Rep IntentSummary x)
-> (forall x. Rep IntentSummary x -> IntentSummary)
-> Generic IntentSummary
forall x. Rep IntentSummary x -> IntentSummary
forall x. IntentSummary -> Rep IntentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntentSummary x -> IntentSummary
$cfrom :: forall x. IntentSummary -> Rep IntentSummary x
Prelude.Generic)

-- |
-- Create a value of 'IntentSummary' 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:
--
-- 'checkpointLabel', 'intentSummary_checkpointLabel' - A user-defined label that identifies a particular intent. You can use
-- this label to return to a previous intent.
--
-- Use the @checkpointLabelFilter@ parameter of the @GetSessionRequest@
-- operation to filter the intents returned by the operation to those with
-- only the specified label.
--
-- 'slots', 'intentSummary_slots' - Map of the slots that have been gathered and their values.
--
-- 'intentName', 'intentSummary_intentName' - The name of the intent.
--
-- 'fulfillmentState', 'intentSummary_fulfillmentState' - The fulfillment state of the intent. The possible values are:
--
-- -   @Failed@ - The Lambda function associated with the intent failed to
--     fulfill the intent.
--
-- -   @Fulfilled@ - The intent has fulfilled by the Lambda function
--     associated with the intent.
--
-- -   @ReadyForFulfillment@ - All of the information necessary for the
--     intent is present and the intent ready to be fulfilled by the client
--     application.
--
-- 'confirmationStatus', 'intentSummary_confirmationStatus' - The status of the intent after the user responds to the confirmation
-- prompt. If the user confirms the intent, Amazon Lex sets this field to
-- @Confirmed@. If the user denies the intent, Amazon Lex sets this value
-- to @Denied@. The possible values are:
--
-- -   @Confirmed@ - The user has responded \"Yes\" to the confirmation
--     prompt, confirming that the intent is complete and that it is ready
--     to be fulfilled.
--
-- -   @Denied@ - The user has responded \"No\" to the confirmation prompt.
--
-- -   @None@ - The user has never been prompted for confirmation; or, the
--     user was prompted but did not confirm or deny the prompt.
--
-- 'slotToElicit', 'intentSummary_slotToElicit' - The next slot to elicit from the user. If there is not slot to elicit,
-- the field is blank.
--
-- 'dialogActionType', 'intentSummary_dialogActionType' - The next action that the bot should take in its interaction with the
-- user. The possible values are:
--
-- -   @ConfirmIntent@ - The next action is asking the user if the intent
--     is complete and ready to be fulfilled. This is a yes\/no question
--     such as \"Place the order?\"
--
-- -   @Close@ - Indicates that the there will not be a response from the
--     user. For example, the statement \"Your order has been placed\" does
--     not require a response.
--
-- -   @ElicitIntent@ - The next action is to determine the intent that the
--     user wants to fulfill.
--
-- -   @ElicitSlot@ - The next action is to elicit a slot value from the
--     user.
newIntentSummary ::
  -- | 'dialogActionType'
  DialogActionType ->
  IntentSummary
newIntentSummary :: DialogActionType -> IntentSummary
newIntentSummary DialogActionType
pDialogActionType_ =
  IntentSummary' :: Maybe Text
-> Maybe (Sensitive (HashMap Text Text))
-> Maybe Text
-> Maybe FulfillmentState
-> Maybe ConfirmationStatus
-> Maybe Text
-> DialogActionType
-> IntentSummary
IntentSummary'
    { $sel:checkpointLabel:IntentSummary' :: Maybe Text
checkpointLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:slots:IntentSummary' :: Maybe (Sensitive (HashMap Text Text))
slots = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
      $sel:intentName:IntentSummary' :: Maybe Text
intentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fulfillmentState:IntentSummary' :: Maybe FulfillmentState
fulfillmentState = Maybe FulfillmentState
forall a. Maybe a
Prelude.Nothing,
      $sel:confirmationStatus:IntentSummary' :: Maybe ConfirmationStatus
confirmationStatus = Maybe ConfirmationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:slotToElicit:IntentSummary' :: Maybe Text
slotToElicit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dialogActionType:IntentSummary' :: DialogActionType
dialogActionType = DialogActionType
pDialogActionType_
    }

-- | A user-defined label that identifies a particular intent. You can use
-- this label to return to a previous intent.
--
-- Use the @checkpointLabelFilter@ parameter of the @GetSessionRequest@
-- operation to filter the intents returned by the operation to those with
-- only the specified label.
intentSummary_checkpointLabel :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_checkpointLabel :: (Maybe Text -> f (Maybe Text)) -> IntentSummary -> f IntentSummary
intentSummary_checkpointLabel = (IntentSummary -> Maybe Text)
-> (IntentSummary -> Maybe Text -> IntentSummary)
-> Lens IntentSummary IntentSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe Text
checkpointLabel :: Maybe Text
$sel:checkpointLabel:IntentSummary' :: IntentSummary -> Maybe Text
checkpointLabel} -> Maybe Text
checkpointLabel) (\s :: IntentSummary
s@IntentSummary' {} Maybe Text
a -> IntentSummary
s {$sel:checkpointLabel:IntentSummary' :: Maybe Text
checkpointLabel = Maybe Text
a} :: IntentSummary)

-- | Map of the slots that have been gathered and their values.
intentSummary_slots :: Lens.Lens' IntentSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
intentSummary_slots :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> IntentSummary -> f IntentSummary
intentSummary_slots = (IntentSummary -> Maybe (Sensitive (HashMap Text Text)))
-> (IntentSummary
    -> Maybe (Sensitive (HashMap Text Text)) -> IntentSummary)
-> Lens
     IntentSummary
     IntentSummary
     (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 (\IntentSummary' {Maybe (Sensitive (HashMap Text Text))
slots :: Maybe (Sensitive (HashMap Text Text))
$sel:slots:IntentSummary' :: IntentSummary -> Maybe (Sensitive (HashMap Text Text))
slots} -> Maybe (Sensitive (HashMap Text Text))
slots) (\s :: IntentSummary
s@IntentSummary' {} Maybe (Sensitive (HashMap Text Text))
a -> IntentSummary
s {$sel:slots:IntentSummary' :: Maybe (Sensitive (HashMap Text Text))
slots = Maybe (Sensitive (HashMap Text Text))
a} :: IntentSummary) ((Maybe (Sensitive (HashMap Text Text))
  -> f (Maybe (Sensitive (HashMap Text Text))))
 -> IntentSummary -> f IntentSummary)
-> ((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)))
-> IntentSummary
-> f IntentSummary
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)

-- | The name of the intent.
intentSummary_intentName :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_intentName :: (Maybe Text -> f (Maybe Text)) -> IntentSummary -> f IntentSummary
intentSummary_intentName = (IntentSummary -> Maybe Text)
-> (IntentSummary -> Maybe Text -> IntentSummary)
-> Lens IntentSummary IntentSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe Text
intentName :: Maybe Text
$sel:intentName:IntentSummary' :: IntentSummary -> Maybe Text
intentName} -> Maybe Text
intentName) (\s :: IntentSummary
s@IntentSummary' {} Maybe Text
a -> IntentSummary
s {$sel:intentName:IntentSummary' :: Maybe Text
intentName = Maybe Text
a} :: IntentSummary)

-- | The fulfillment state of the intent. The possible values are:
--
-- -   @Failed@ - The Lambda function associated with the intent failed to
--     fulfill the intent.
--
-- -   @Fulfilled@ - The intent has fulfilled by the Lambda function
--     associated with the intent.
--
-- -   @ReadyForFulfillment@ - All of the information necessary for the
--     intent is present and the intent ready to be fulfilled by the client
--     application.
intentSummary_fulfillmentState :: Lens.Lens' IntentSummary (Prelude.Maybe FulfillmentState)
intentSummary_fulfillmentState :: (Maybe FulfillmentState -> f (Maybe FulfillmentState))
-> IntentSummary -> f IntentSummary
intentSummary_fulfillmentState = (IntentSummary -> Maybe FulfillmentState)
-> (IntentSummary -> Maybe FulfillmentState -> IntentSummary)
-> Lens
     IntentSummary
     IntentSummary
     (Maybe FulfillmentState)
     (Maybe FulfillmentState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe FulfillmentState
fulfillmentState :: Maybe FulfillmentState
$sel:fulfillmentState:IntentSummary' :: IntentSummary -> Maybe FulfillmentState
fulfillmentState} -> Maybe FulfillmentState
fulfillmentState) (\s :: IntentSummary
s@IntentSummary' {} Maybe FulfillmentState
a -> IntentSummary
s {$sel:fulfillmentState:IntentSummary' :: Maybe FulfillmentState
fulfillmentState = Maybe FulfillmentState
a} :: IntentSummary)

-- | The status of the intent after the user responds to the confirmation
-- prompt. If the user confirms the intent, Amazon Lex sets this field to
-- @Confirmed@. If the user denies the intent, Amazon Lex sets this value
-- to @Denied@. The possible values are:
--
-- -   @Confirmed@ - The user has responded \"Yes\" to the confirmation
--     prompt, confirming that the intent is complete and that it is ready
--     to be fulfilled.
--
-- -   @Denied@ - The user has responded \"No\" to the confirmation prompt.
--
-- -   @None@ - The user has never been prompted for confirmation; or, the
--     user was prompted but did not confirm or deny the prompt.
intentSummary_confirmationStatus :: Lens.Lens' IntentSummary (Prelude.Maybe ConfirmationStatus)
intentSummary_confirmationStatus :: (Maybe ConfirmationStatus -> f (Maybe ConfirmationStatus))
-> IntentSummary -> f IntentSummary
intentSummary_confirmationStatus = (IntentSummary -> Maybe ConfirmationStatus)
-> (IntentSummary -> Maybe ConfirmationStatus -> IntentSummary)
-> Lens
     IntentSummary
     IntentSummary
     (Maybe ConfirmationStatus)
     (Maybe ConfirmationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe ConfirmationStatus
confirmationStatus :: Maybe ConfirmationStatus
$sel:confirmationStatus:IntentSummary' :: IntentSummary -> Maybe ConfirmationStatus
confirmationStatus} -> Maybe ConfirmationStatus
confirmationStatus) (\s :: IntentSummary
s@IntentSummary' {} Maybe ConfirmationStatus
a -> IntentSummary
s {$sel:confirmationStatus:IntentSummary' :: Maybe ConfirmationStatus
confirmationStatus = Maybe ConfirmationStatus
a} :: IntentSummary)

-- | The next slot to elicit from the user. If there is not slot to elicit,
-- the field is blank.
intentSummary_slotToElicit :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_slotToElicit :: (Maybe Text -> f (Maybe Text)) -> IntentSummary -> f IntentSummary
intentSummary_slotToElicit = (IntentSummary -> Maybe Text)
-> (IntentSummary -> Maybe Text -> IntentSummary)
-> Lens IntentSummary IntentSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe Text
slotToElicit :: Maybe Text
$sel:slotToElicit:IntentSummary' :: IntentSummary -> Maybe Text
slotToElicit} -> Maybe Text
slotToElicit) (\s :: IntentSummary
s@IntentSummary' {} Maybe Text
a -> IntentSummary
s {$sel:slotToElicit:IntentSummary' :: Maybe Text
slotToElicit = Maybe Text
a} :: IntentSummary)

-- | The next action that the bot should take in its interaction with the
-- user. The possible values are:
--
-- -   @ConfirmIntent@ - The next action is asking the user if the intent
--     is complete and ready to be fulfilled. This is a yes\/no question
--     such as \"Place the order?\"
--
-- -   @Close@ - Indicates that the there will not be a response from the
--     user. For example, the statement \"Your order has been placed\" does
--     not require a response.
--
-- -   @ElicitIntent@ - The next action is to determine the intent that the
--     user wants to fulfill.
--
-- -   @ElicitSlot@ - The next action is to elicit a slot value from the
--     user.
intentSummary_dialogActionType :: Lens.Lens' IntentSummary DialogActionType
intentSummary_dialogActionType :: (DialogActionType -> f DialogActionType)
-> IntentSummary -> f IntentSummary
intentSummary_dialogActionType = (IntentSummary -> DialogActionType)
-> (IntentSummary -> DialogActionType -> IntentSummary)
-> Lens
     IntentSummary IntentSummary DialogActionType DialogActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {DialogActionType
dialogActionType :: DialogActionType
$sel:dialogActionType:IntentSummary' :: IntentSummary -> DialogActionType
dialogActionType} -> DialogActionType
dialogActionType) (\s :: IntentSummary
s@IntentSummary' {} DialogActionType
a -> IntentSummary
s {$sel:dialogActionType:IntentSummary' :: DialogActionType
dialogActionType = DialogActionType
a} :: IntentSummary)

instance Core.FromJSON IntentSummary where
  parseJSON :: Value -> Parser IntentSummary
parseJSON =
    String
-> (Object -> Parser IntentSummary)
-> Value
-> Parser IntentSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IntentSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe (Sensitive (HashMap Text Text))
-> Maybe Text
-> Maybe FulfillmentState
-> Maybe ConfirmationStatus
-> Maybe Text
-> DialogActionType
-> IntentSummary
IntentSummary'
            (Maybe Text
 -> Maybe (Sensitive (HashMap Text Text))
 -> Maybe Text
 -> Maybe FulfillmentState
 -> Maybe ConfirmationStatus
 -> Maybe Text
 -> DialogActionType
 -> IntentSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive (HashMap Text Text))
      -> Maybe Text
      -> Maybe FulfillmentState
      -> Maybe ConfirmationStatus
      -> Maybe Text
      -> DialogActionType
      -> IntentSummary)
forall (f :: * -> *) a b. Functor 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
"checkpointLabel")
            Parser
  (Maybe (Sensitive (HashMap Text Text))
   -> Maybe Text
   -> Maybe FulfillmentState
   -> Maybe ConfirmationStatus
   -> Maybe Text
   -> DialogActionType
   -> IntentSummary)
-> Parser (Maybe (Sensitive (HashMap Text Text)))
-> Parser
     (Maybe Text
      -> Maybe FulfillmentState
      -> Maybe ConfirmationStatus
      -> Maybe Text
      -> DialogActionType
      -> IntentSummary)
forall (f :: * -> *) a b. Applicative f => 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 ConfirmationStatus
   -> Maybe Text
   -> DialogActionType
   -> IntentSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe FulfillmentState
      -> Maybe ConfirmationStatus
      -> Maybe Text
      -> DialogActionType
      -> IntentSummary)
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 ConfirmationStatus
   -> Maybe Text
   -> DialogActionType
   -> IntentSummary)
-> Parser (Maybe FulfillmentState)
-> Parser
     (Maybe ConfirmationStatus
      -> Maybe Text -> DialogActionType -> IntentSummary)
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 ConfirmationStatus
   -> Maybe Text -> DialogActionType -> IntentSummary)
-> Parser (Maybe ConfirmationStatus)
-> Parser (Maybe Text -> DialogActionType -> IntentSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfirmationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"confirmationStatus")
            Parser (Maybe Text -> DialogActionType -> IntentSummary)
-> Parser (Maybe Text)
-> Parser (DialogActionType -> IntentSummary)
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 -> IntentSummary)
-> Parser DialogActionType -> Parser IntentSummary
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
"dialogActionType")
      )

instance Prelude.Hashable IntentSummary

instance Prelude.NFData IntentSummary

instance Core.ToJSON IntentSummary where
  toJSON :: IntentSummary -> Value
toJSON IntentSummary' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe ConfirmationStatus
Maybe FulfillmentState
DialogActionType
dialogActionType :: DialogActionType
slotToElicit :: Maybe Text
confirmationStatus :: Maybe ConfirmationStatus
fulfillmentState :: Maybe FulfillmentState
intentName :: Maybe Text
slots :: Maybe (Sensitive (HashMap Text Text))
checkpointLabel :: Maybe Text
$sel:dialogActionType:IntentSummary' :: IntentSummary -> DialogActionType
$sel:slotToElicit:IntentSummary' :: IntentSummary -> Maybe Text
$sel:confirmationStatus:IntentSummary' :: IntentSummary -> Maybe ConfirmationStatus
$sel:fulfillmentState:IntentSummary' :: IntentSummary -> Maybe FulfillmentState
$sel:intentName:IntentSummary' :: IntentSummary -> Maybe Text
$sel:slots:IntentSummary' :: IntentSummary -> Maybe (Sensitive (HashMap Text Text))
$sel:checkpointLabel:IntentSummary' :: IntentSummary -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"checkpointLabel" 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
checkpointLabel,
            (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
"confirmationStatus" Text -> ConfirmationStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfirmationStatus -> Pair)
-> Maybe ConfirmationStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfirmationStatus
confirmationStatus,
            (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
"dialogActionType" Text -> DialogActionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DialogActionType
dialogActionType)
          ]
      )