{-# 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.AggregatedUtterancesSummary
-- 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.AggregatedUtterancesSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Provides summary information for aggregated utterances. The
-- @ListAggregatedUtterances@ operations combines all instances of the same
-- utterance into a single aggregated summary.
--
-- /See:/ 'newAggregatedUtterancesSummary' smart constructor.
data AggregatedUtterancesSummary = AggregatedUtterancesSummary'
  { -- | Aggregated utterance data may contain utterances from versions of your
    -- bot that have since been deleted. When the aggregated contains this kind
    -- of data, this field is set to true.
    AggregatedUtterancesSummary -> Maybe Bool
containsDataFromDeletedResources :: Prelude.Maybe Prelude.Bool,
    -- | The number of times that the utterance was detected by Amazon Lex during
    -- the time period. When an utterance is detected, it activates an intent
    -- or a slot.
    AggregatedUtterancesSummary -> Maybe Int
hitCount :: Prelude.Maybe Prelude.Int,
    -- | The number of times that the utterance was missed by Amazon Lex An
    -- utterance is missed when it doesn\'t activate an intent or slot.
    AggregatedUtterancesSummary -> Maybe Int
missedCount :: Prelude.Maybe Prelude.Int,
    -- | The text of the utterance. If the utterance was used with the
    -- @RecognizeUtterance@ operation, the text is the transcription of the
    -- audio utterance.
    AggregatedUtterancesSummary -> Maybe Text
utterance :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the utterance was first recorded in the time
    -- window for aggregation. An utterance may have been sent to Amazon Lex
    -- before that time, but only utterances within the time window are
    -- counted.
    AggregatedUtterancesSummary -> Maybe POSIX
utteranceFirstRecordedInAggregationDuration :: Prelude.Maybe Data.POSIX,
    -- | The last date and time that an utterance was recorded in the time window
    -- for aggregation. An utterance may be sent to Amazon Lex after that time,
    -- but only utterances within the time window are counted.
    AggregatedUtterancesSummary -> Maybe POSIX
utteranceLastRecordedInAggregationDuration :: Prelude.Maybe Data.POSIX
  }
  deriving (AggregatedUtterancesSummary -> AggregatedUtterancesSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedUtterancesSummary -> AggregatedUtterancesSummary -> Bool
$c/= :: AggregatedUtterancesSummary -> AggregatedUtterancesSummary -> Bool
== :: AggregatedUtterancesSummary -> AggregatedUtterancesSummary -> Bool
$c== :: AggregatedUtterancesSummary -> AggregatedUtterancesSummary -> Bool
Prelude.Eq, ReadPrec [AggregatedUtterancesSummary]
ReadPrec AggregatedUtterancesSummary
Int -> ReadS AggregatedUtterancesSummary
ReadS [AggregatedUtterancesSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedUtterancesSummary]
$creadListPrec :: ReadPrec [AggregatedUtterancesSummary]
readPrec :: ReadPrec AggregatedUtterancesSummary
$creadPrec :: ReadPrec AggregatedUtterancesSummary
readList :: ReadS [AggregatedUtterancesSummary]
$creadList :: ReadS [AggregatedUtterancesSummary]
readsPrec :: Int -> ReadS AggregatedUtterancesSummary
$creadsPrec :: Int -> ReadS AggregatedUtterancesSummary
Prelude.Read, Int -> AggregatedUtterancesSummary -> ShowS
[AggregatedUtterancesSummary] -> ShowS
AggregatedUtterancesSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedUtterancesSummary] -> ShowS
$cshowList :: [AggregatedUtterancesSummary] -> ShowS
show :: AggregatedUtterancesSummary -> String
$cshow :: AggregatedUtterancesSummary -> String
showsPrec :: Int -> AggregatedUtterancesSummary -> ShowS
$cshowsPrec :: Int -> AggregatedUtterancesSummary -> ShowS
Prelude.Show, forall x.
Rep AggregatedUtterancesSummary x -> AggregatedUtterancesSummary
forall x.
AggregatedUtterancesSummary -> Rep AggregatedUtterancesSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AggregatedUtterancesSummary x -> AggregatedUtterancesSummary
$cfrom :: forall x.
AggregatedUtterancesSummary -> Rep AggregatedUtterancesSummary x
Prelude.Generic)

-- |
-- Create a value of 'AggregatedUtterancesSummary' 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:
--
-- 'containsDataFromDeletedResources', 'aggregatedUtterancesSummary_containsDataFromDeletedResources' - Aggregated utterance data may contain utterances from versions of your
-- bot that have since been deleted. When the aggregated contains this kind
-- of data, this field is set to true.
--
-- 'hitCount', 'aggregatedUtterancesSummary_hitCount' - The number of times that the utterance was detected by Amazon Lex during
-- the time period. When an utterance is detected, it activates an intent
-- or a slot.
--
-- 'missedCount', 'aggregatedUtterancesSummary_missedCount' - The number of times that the utterance was missed by Amazon Lex An
-- utterance is missed when it doesn\'t activate an intent or slot.
--
-- 'utterance', 'aggregatedUtterancesSummary_utterance' - The text of the utterance. If the utterance was used with the
-- @RecognizeUtterance@ operation, the text is the transcription of the
-- audio utterance.
--
-- 'utteranceFirstRecordedInAggregationDuration', 'aggregatedUtterancesSummary_utteranceFirstRecordedInAggregationDuration' - The date and time that the utterance was first recorded in the time
-- window for aggregation. An utterance may have been sent to Amazon Lex
-- before that time, but only utterances within the time window are
-- counted.
--
-- 'utteranceLastRecordedInAggregationDuration', 'aggregatedUtterancesSummary_utteranceLastRecordedInAggregationDuration' - The last date and time that an utterance was recorded in the time window
-- for aggregation. An utterance may be sent to Amazon Lex after that time,
-- but only utterances within the time window are counted.
newAggregatedUtterancesSummary ::
  AggregatedUtterancesSummary
newAggregatedUtterancesSummary :: AggregatedUtterancesSummary
newAggregatedUtterancesSummary =
  AggregatedUtterancesSummary'
    { $sel:containsDataFromDeletedResources:AggregatedUtterancesSummary' :: Maybe Bool
containsDataFromDeletedResources =
        forall a. Maybe a
Prelude.Nothing,
      $sel:hitCount:AggregatedUtterancesSummary' :: Maybe Int
hitCount = forall a. Maybe a
Prelude.Nothing,
      $sel:missedCount:AggregatedUtterancesSummary' :: Maybe Int
missedCount = forall a. Maybe a
Prelude.Nothing,
      $sel:utterance:AggregatedUtterancesSummary' :: Maybe Text
utterance = forall a. Maybe a
Prelude.Nothing,
      $sel:utteranceFirstRecordedInAggregationDuration:AggregatedUtterancesSummary' :: Maybe POSIX
utteranceFirstRecordedInAggregationDuration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:utteranceLastRecordedInAggregationDuration:AggregatedUtterancesSummary' :: Maybe POSIX
utteranceLastRecordedInAggregationDuration =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Aggregated utterance data may contain utterances from versions of your
-- bot that have since been deleted. When the aggregated contains this kind
-- of data, this field is set to true.
aggregatedUtterancesSummary_containsDataFromDeletedResources :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.Bool)
aggregatedUtterancesSummary_containsDataFromDeletedResources :: Lens' AggregatedUtterancesSummary (Maybe Bool)
aggregatedUtterancesSummary_containsDataFromDeletedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe Bool
containsDataFromDeletedResources :: Maybe Bool
$sel:containsDataFromDeletedResources:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Bool
containsDataFromDeletedResources} -> Maybe Bool
containsDataFromDeletedResources) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe Bool
a -> AggregatedUtterancesSummary
s {$sel:containsDataFromDeletedResources:AggregatedUtterancesSummary' :: Maybe Bool
containsDataFromDeletedResources = Maybe Bool
a} :: AggregatedUtterancesSummary)

-- | The number of times that the utterance was detected by Amazon Lex during
-- the time period. When an utterance is detected, it activates an intent
-- or a slot.
aggregatedUtterancesSummary_hitCount :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.Int)
aggregatedUtterancesSummary_hitCount :: Lens' AggregatedUtterancesSummary (Maybe Int)
aggregatedUtterancesSummary_hitCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe Int
hitCount :: Maybe Int
$sel:hitCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
hitCount} -> Maybe Int
hitCount) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe Int
a -> AggregatedUtterancesSummary
s {$sel:hitCount:AggregatedUtterancesSummary' :: Maybe Int
hitCount = Maybe Int
a} :: AggregatedUtterancesSummary)

-- | The number of times that the utterance was missed by Amazon Lex An
-- utterance is missed when it doesn\'t activate an intent or slot.
aggregatedUtterancesSummary_missedCount :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.Int)
aggregatedUtterancesSummary_missedCount :: Lens' AggregatedUtterancesSummary (Maybe Int)
aggregatedUtterancesSummary_missedCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe Int
missedCount :: Maybe Int
$sel:missedCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
missedCount} -> Maybe Int
missedCount) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe Int
a -> AggregatedUtterancesSummary
s {$sel:missedCount:AggregatedUtterancesSummary' :: Maybe Int
missedCount = Maybe Int
a} :: AggregatedUtterancesSummary)

-- | The text of the utterance. If the utterance was used with the
-- @RecognizeUtterance@ operation, the text is the transcription of the
-- audio utterance.
aggregatedUtterancesSummary_utterance :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.Text)
aggregatedUtterancesSummary_utterance :: Lens' AggregatedUtterancesSummary (Maybe Text)
aggregatedUtterancesSummary_utterance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe Text
utterance :: Maybe Text
$sel:utterance:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Text
utterance} -> Maybe Text
utterance) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe Text
a -> AggregatedUtterancesSummary
s {$sel:utterance:AggregatedUtterancesSummary' :: Maybe Text
utterance = Maybe Text
a} :: AggregatedUtterancesSummary)

-- | The date and time that the utterance was first recorded in the time
-- window for aggregation. An utterance may have been sent to Amazon Lex
-- before that time, but only utterances within the time window are
-- counted.
aggregatedUtterancesSummary_utteranceFirstRecordedInAggregationDuration :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.UTCTime)
aggregatedUtterancesSummary_utteranceFirstRecordedInAggregationDuration :: Lens' AggregatedUtterancesSummary (Maybe UTCTime)
aggregatedUtterancesSummary_utteranceFirstRecordedInAggregationDuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe POSIX
utteranceFirstRecordedInAggregationDuration :: Maybe POSIX
$sel:utteranceFirstRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
utteranceFirstRecordedInAggregationDuration} -> Maybe POSIX
utteranceFirstRecordedInAggregationDuration) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe POSIX
a -> AggregatedUtterancesSummary
s {$sel:utteranceFirstRecordedInAggregationDuration:AggregatedUtterancesSummary' :: Maybe POSIX
utteranceFirstRecordedInAggregationDuration = Maybe POSIX
a} :: AggregatedUtterancesSummary) 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 last date and time that an utterance was recorded in the time window
-- for aggregation. An utterance may be sent to Amazon Lex after that time,
-- but only utterances within the time window are counted.
aggregatedUtterancesSummary_utteranceLastRecordedInAggregationDuration :: Lens.Lens' AggregatedUtterancesSummary (Prelude.Maybe Prelude.UTCTime)
aggregatedUtterancesSummary_utteranceLastRecordedInAggregationDuration :: Lens' AggregatedUtterancesSummary (Maybe UTCTime)
aggregatedUtterancesSummary_utteranceLastRecordedInAggregationDuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedUtterancesSummary' {Maybe POSIX
utteranceLastRecordedInAggregationDuration :: Maybe POSIX
$sel:utteranceLastRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
utteranceLastRecordedInAggregationDuration} -> Maybe POSIX
utteranceLastRecordedInAggregationDuration) (\s :: AggregatedUtterancesSummary
s@AggregatedUtterancesSummary' {} Maybe POSIX
a -> AggregatedUtterancesSummary
s {$sel:utteranceLastRecordedInAggregationDuration:AggregatedUtterancesSummary' :: Maybe POSIX
utteranceLastRecordedInAggregationDuration = Maybe POSIX
a} :: AggregatedUtterancesSummary) 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

instance Data.FromJSON AggregatedUtterancesSummary where
  parseJSON :: Value -> Parser AggregatedUtterancesSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AggregatedUtterancesSummary"
      ( \Object
x ->
          Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> AggregatedUtterancesSummary
AggregatedUtterancesSummary'
            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
"containsDataFromDeletedResources")
            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
"hitCount")
            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
"missedCount")
            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
"utterance")
            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
"utteranceFirstRecordedInAggregationDuration"
                        )
            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
"utteranceLastRecordedInAggregationDuration"
                        )
      )

instance Prelude.Hashable AggregatedUtterancesSummary where
  hashWithSalt :: Int -> AggregatedUtterancesSummary -> Int
hashWithSalt Int
_salt AggregatedUtterancesSummary' {Maybe Bool
Maybe Int
Maybe Text
Maybe POSIX
utteranceLastRecordedInAggregationDuration :: Maybe POSIX
utteranceFirstRecordedInAggregationDuration :: Maybe POSIX
utterance :: Maybe Text
missedCount :: Maybe Int
hitCount :: Maybe Int
containsDataFromDeletedResources :: Maybe Bool
$sel:utteranceLastRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
$sel:utteranceFirstRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
$sel:utterance:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Text
$sel:missedCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
$sel:hitCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
$sel:containsDataFromDeletedResources:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
containsDataFromDeletedResources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
hitCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
missedCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
utterance
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
utteranceFirstRecordedInAggregationDuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
utteranceLastRecordedInAggregationDuration

instance Prelude.NFData AggregatedUtterancesSummary where
  rnf :: AggregatedUtterancesSummary -> ()
rnf AggregatedUtterancesSummary' {Maybe Bool
Maybe Int
Maybe Text
Maybe POSIX
utteranceLastRecordedInAggregationDuration :: Maybe POSIX
utteranceFirstRecordedInAggregationDuration :: Maybe POSIX
utterance :: Maybe Text
missedCount :: Maybe Int
hitCount :: Maybe Int
containsDataFromDeletedResources :: Maybe Bool
$sel:utteranceLastRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
$sel:utteranceFirstRecordedInAggregationDuration:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe POSIX
$sel:utterance:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Text
$sel:missedCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
$sel:hitCount:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Int
$sel:containsDataFromDeletedResources:AggregatedUtterancesSummary' :: AggregatedUtterancesSummary -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
containsDataFromDeletedResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
hitCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
missedCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
utterance
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe POSIX
utteranceFirstRecordedInAggregationDuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe POSIX
utteranceLastRecordedInAggregationDuration