{-# 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.LexV2Models.Types.IntentSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexV2Models.Types.IntentSummary 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.InputContext
import Amazonka.LexV2Models.Types.OutputContext
import qualified Amazonka.Prelude as Prelude

-- | Summary information about an intent returned by the @ListIntents@
-- operation.
--
-- /See:/ 'newIntentSummary' smart constructor.
data IntentSummary = IntentSummary'
  { -- | The description of the intent.
    IntentSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The input contexts that must be active for this intent to be considered
    -- for recognition.
    IntentSummary -> Maybe [InputContext]
inputContexts :: Prelude.Maybe [InputContext],
    -- | The unique identifier assigned to the intent. Use this ID to get
    -- detailed information about the intent with the @DescribeIntent@
    -- operation.
    IntentSummary -> Maybe Text
intentId :: Prelude.Maybe Prelude.Text,
    -- | The name of the intent.
    IntentSummary -> Maybe Text
intentName :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of the date and time that the intent was last updated.
    IntentSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Data.POSIX,
    -- | The output contexts that are activated when this intent is fulfilled.
    IntentSummary -> Maybe [OutputContext]
outputContexts :: Prelude.Maybe [OutputContext],
    -- | If this intent is derived from a built-in intent, the name of the parent
    -- intent.
    IntentSummary -> Maybe Text
parentIntentSignature :: Prelude.Maybe Prelude.Text
  }
  deriving (IntentSummary -> IntentSummary -> Bool
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, ReadPrec [IntentSummary]
ReadPrec IntentSummary
Int -> ReadS IntentSummary
ReadS [IntentSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntentSummary]
$creadListPrec :: ReadPrec [IntentSummary]
readPrec :: ReadPrec IntentSummary
$creadPrec :: ReadPrec IntentSummary
readList :: ReadS [IntentSummary]
$creadList :: ReadS [IntentSummary]
readsPrec :: Int -> ReadS IntentSummary
$creadsPrec :: Int -> ReadS IntentSummary
Prelude.Read, Int -> IntentSummary -> ShowS
[IntentSummary] -> ShowS
IntentSummary -> String
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. 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:
--
-- 'description', 'intentSummary_description' - The description of the intent.
--
-- 'inputContexts', 'intentSummary_inputContexts' - The input contexts that must be active for this intent to be considered
-- for recognition.
--
-- 'intentId', 'intentSummary_intentId' - The unique identifier assigned to the intent. Use this ID to get
-- detailed information about the intent with the @DescribeIntent@
-- operation.
--
-- 'intentName', 'intentSummary_intentName' - The name of the intent.
--
-- 'lastUpdatedDateTime', 'intentSummary_lastUpdatedDateTime' - The timestamp of the date and time that the intent was last updated.
--
-- 'outputContexts', 'intentSummary_outputContexts' - The output contexts that are activated when this intent is fulfilled.
--
-- 'parentIntentSignature', 'intentSummary_parentIntentSignature' - If this intent is derived from a built-in intent, the name of the parent
-- intent.
newIntentSummary ::
  IntentSummary
newIntentSummary :: IntentSummary
newIntentSummary =
  IntentSummary'
    { $sel:description:IntentSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:inputContexts:IntentSummary' :: Maybe [InputContext]
inputContexts = forall a. Maybe a
Prelude.Nothing,
      $sel:intentId:IntentSummary' :: Maybe Text
intentId = forall a. Maybe a
Prelude.Nothing,
      $sel:intentName:IntentSummary' :: Maybe Text
intentName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:IntentSummary' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:outputContexts:IntentSummary' :: Maybe [OutputContext]
outputContexts = forall a. Maybe a
Prelude.Nothing,
      $sel:parentIntentSignature:IntentSummary' :: Maybe Text
parentIntentSignature = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The input contexts that must be active for this intent to be considered
-- for recognition.
intentSummary_inputContexts :: Lens.Lens' IntentSummary (Prelude.Maybe [InputContext])
intentSummary_inputContexts :: Lens' IntentSummary (Maybe [InputContext])
intentSummary_inputContexts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe [InputContext]
inputContexts :: Maybe [InputContext]
$sel:inputContexts:IntentSummary' :: IntentSummary -> Maybe [InputContext]
inputContexts} -> Maybe [InputContext]
inputContexts) (\s :: IntentSummary
s@IntentSummary' {} Maybe [InputContext]
a -> IntentSummary
s {$sel:inputContexts:IntentSummary' :: Maybe [InputContext]
inputContexts = Maybe [InputContext]
a} :: IntentSummary) 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

-- | The unique identifier assigned to the intent. Use this ID to get
-- detailed information about the intent with the @DescribeIntent@
-- operation.
intentSummary_intentId :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_intentId :: Lens' IntentSummary (Maybe Text)
intentSummary_intentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe Text
intentId :: Maybe Text
$sel:intentId:IntentSummary' :: IntentSummary -> Maybe Text
intentId} -> Maybe Text
intentId) (\s :: IntentSummary
s@IntentSummary' {} Maybe Text
a -> IntentSummary
s {$sel:intentId:IntentSummary' :: Maybe Text
intentId = Maybe Text
a} :: IntentSummary)

-- | The name of the intent.
intentSummary_intentName :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_intentName :: Lens' IntentSummary (Maybe Text)
intentSummary_intentName = 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 timestamp of the date and time that the intent was last updated.
intentSummary_lastUpdatedDateTime :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.UTCTime)
intentSummary_lastUpdatedDateTime :: Lens' IntentSummary (Maybe UTCTime)
intentSummary_lastUpdatedDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:IntentSummary' :: IntentSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: IntentSummary
s@IntentSummary' {} Maybe POSIX
a -> IntentSummary
s {$sel:lastUpdatedDateTime:IntentSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: IntentSummary) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The output contexts that are activated when this intent is fulfilled.
intentSummary_outputContexts :: Lens.Lens' IntentSummary (Prelude.Maybe [OutputContext])
intentSummary_outputContexts :: Lens' IntentSummary (Maybe [OutputContext])
intentSummary_outputContexts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe [OutputContext]
outputContexts :: Maybe [OutputContext]
$sel:outputContexts:IntentSummary' :: IntentSummary -> Maybe [OutputContext]
outputContexts} -> Maybe [OutputContext]
outputContexts) (\s :: IntentSummary
s@IntentSummary' {} Maybe [OutputContext]
a -> IntentSummary
s {$sel:outputContexts:IntentSummary' :: Maybe [OutputContext]
outputContexts = Maybe [OutputContext]
a} :: IntentSummary) 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

-- | If this intent is derived from a built-in intent, the name of the parent
-- intent.
intentSummary_parentIntentSignature :: Lens.Lens' IntentSummary (Prelude.Maybe Prelude.Text)
intentSummary_parentIntentSignature :: Lens' IntentSummary (Maybe Text)
intentSummary_parentIntentSignature = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSummary' {Maybe Text
parentIntentSignature :: Maybe Text
$sel:parentIntentSignature:IntentSummary' :: IntentSummary -> Maybe Text
parentIntentSignature} -> Maybe Text
parentIntentSignature) (\s :: IntentSummary
s@IntentSummary' {} Maybe Text
a -> IntentSummary
s {$sel:parentIntentSignature:IntentSummary' :: Maybe Text
parentIntentSignature = Maybe Text
a} :: IntentSummary)

instance Data.FromJSON IntentSummary where
  parseJSON :: Value -> Parser IntentSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IntentSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe [InputContext]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe [OutputContext]
-> Maybe Text
-> IntentSummary
IntentSummary'
            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
"description")
            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
"inputContexts" 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 (Maybe a)
Data..:? Key
"intentId")
            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
"lastUpdatedDateTime")
            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
"outputContexts" 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 (Maybe a)
Data..:? Key
"parentIntentSignature")
      )

instance Prelude.Hashable IntentSummary where
  hashWithSalt :: Int -> IntentSummary -> Int
hashWithSalt Int
_salt IntentSummary' {Maybe [InputContext]
Maybe [OutputContext]
Maybe Text
Maybe POSIX
parentIntentSignature :: Maybe Text
outputContexts :: Maybe [OutputContext]
lastUpdatedDateTime :: Maybe POSIX
intentName :: Maybe Text
intentId :: Maybe Text
inputContexts :: Maybe [InputContext]
description :: Maybe Text
$sel:parentIntentSignature:IntentSummary' :: IntentSummary -> Maybe Text
$sel:outputContexts:IntentSummary' :: IntentSummary -> Maybe [OutputContext]
$sel:lastUpdatedDateTime:IntentSummary' :: IntentSummary -> Maybe POSIX
$sel:intentName:IntentSummary' :: IntentSummary -> Maybe Text
$sel:intentId:IntentSummary' :: IntentSummary -> Maybe Text
$sel:inputContexts:IntentSummary' :: IntentSummary -> Maybe [InputContext]
$sel:description:IntentSummary' :: IntentSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InputContext]
inputContexts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
intentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
intentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OutputContext]
outputContexts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parentIntentSignature

instance Prelude.NFData IntentSummary where
  rnf :: IntentSummary -> ()
rnf IntentSummary' {Maybe [InputContext]
Maybe [OutputContext]
Maybe Text
Maybe POSIX
parentIntentSignature :: Maybe Text
outputContexts :: Maybe [OutputContext]
lastUpdatedDateTime :: Maybe POSIX
intentName :: Maybe Text
intentId :: Maybe Text
inputContexts :: Maybe [InputContext]
description :: Maybe Text
$sel:parentIntentSignature:IntentSummary' :: IntentSummary -> Maybe Text
$sel:outputContexts:IntentSummary' :: IntentSummary -> Maybe [OutputContext]
$sel:lastUpdatedDateTime:IntentSummary' :: IntentSummary -> Maybe POSIX
$sel:intentName:IntentSummary' :: IntentSummary -> Maybe Text
$sel:intentId:IntentSummary' :: IntentSummary -> Maybe Text
$sel:inputContexts:IntentSummary' :: IntentSummary -> Maybe [InputContext]
$sel:description:IntentSummary' :: IntentSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [InputContext]
inputContexts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
intentId
      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 POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OutputContext]
outputContexts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
parentIntentSignature