{-# 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.LexModels.Types.UtteranceData
-- 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.LexModels.Types.UtteranceData 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 information about a single utterance that was made to your bot.
--
-- /See:/ 'newUtteranceData' smart constructor.
data UtteranceData = UtteranceData'
  { -- | The number of times that the utterance was processed.
    UtteranceData -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The total number of individuals that used the utterance.
    UtteranceData -> Maybe Int
distinctUsers :: Prelude.Maybe Prelude.Int,
    -- | The date that the utterance was first recorded.
    UtteranceData -> Maybe POSIX
firstUtteredDate :: Prelude.Maybe Data.POSIX,
    -- | The date that the utterance was last recorded.
    UtteranceData -> Maybe POSIX
lastUtteredDate :: Prelude.Maybe Data.POSIX,
    -- | The text that was entered by the user or the text representation of an
    -- audio clip.
    UtteranceData -> Maybe Text
utteranceString :: Prelude.Maybe Prelude.Text
  }
  deriving (UtteranceData -> UtteranceData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UtteranceData -> UtteranceData -> Bool
$c/= :: UtteranceData -> UtteranceData -> Bool
== :: UtteranceData -> UtteranceData -> Bool
$c== :: UtteranceData -> UtteranceData -> Bool
Prelude.Eq, ReadPrec [UtteranceData]
ReadPrec UtteranceData
Int -> ReadS UtteranceData
ReadS [UtteranceData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UtteranceData]
$creadListPrec :: ReadPrec [UtteranceData]
readPrec :: ReadPrec UtteranceData
$creadPrec :: ReadPrec UtteranceData
readList :: ReadS [UtteranceData]
$creadList :: ReadS [UtteranceData]
readsPrec :: Int -> ReadS UtteranceData
$creadsPrec :: Int -> ReadS UtteranceData
Prelude.Read, Int -> UtteranceData -> ShowS
[UtteranceData] -> ShowS
UtteranceData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UtteranceData] -> ShowS
$cshowList :: [UtteranceData] -> ShowS
show :: UtteranceData -> String
$cshow :: UtteranceData -> String
showsPrec :: Int -> UtteranceData -> ShowS
$cshowsPrec :: Int -> UtteranceData -> ShowS
Prelude.Show, forall x. Rep UtteranceData x -> UtteranceData
forall x. UtteranceData -> Rep UtteranceData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UtteranceData x -> UtteranceData
$cfrom :: forall x. UtteranceData -> Rep UtteranceData x
Prelude.Generic)

-- |
-- Create a value of 'UtteranceData' 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:
--
-- 'count', 'utteranceData_count' - The number of times that the utterance was processed.
--
-- 'distinctUsers', 'utteranceData_distinctUsers' - The total number of individuals that used the utterance.
--
-- 'firstUtteredDate', 'utteranceData_firstUtteredDate' - The date that the utterance was first recorded.
--
-- 'lastUtteredDate', 'utteranceData_lastUtteredDate' - The date that the utterance was last recorded.
--
-- 'utteranceString', 'utteranceData_utteranceString' - The text that was entered by the user or the text representation of an
-- audio clip.
newUtteranceData ::
  UtteranceData
newUtteranceData :: UtteranceData
newUtteranceData =
  UtteranceData'
    { $sel:count:UtteranceData' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:distinctUsers:UtteranceData' :: Maybe Int
distinctUsers = forall a. Maybe a
Prelude.Nothing,
      $sel:firstUtteredDate:UtteranceData' :: Maybe POSIX
firstUtteredDate = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUtteredDate:UtteranceData' :: Maybe POSIX
lastUtteredDate = forall a. Maybe a
Prelude.Nothing,
      $sel:utteranceString:UtteranceData' :: Maybe Text
utteranceString = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of times that the utterance was processed.
utteranceData_count :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.Int)
utteranceData_count :: Lens' UtteranceData (Maybe Int)
utteranceData_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceData' {Maybe Int
count :: Maybe Int
$sel:count:UtteranceData' :: UtteranceData -> Maybe Int
count} -> Maybe Int
count) (\s :: UtteranceData
s@UtteranceData' {} Maybe Int
a -> UtteranceData
s {$sel:count:UtteranceData' :: Maybe Int
count = Maybe Int
a} :: UtteranceData)

-- | The total number of individuals that used the utterance.
utteranceData_distinctUsers :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.Int)
utteranceData_distinctUsers :: Lens' UtteranceData (Maybe Int)
utteranceData_distinctUsers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceData' {Maybe Int
distinctUsers :: Maybe Int
$sel:distinctUsers:UtteranceData' :: UtteranceData -> Maybe Int
distinctUsers} -> Maybe Int
distinctUsers) (\s :: UtteranceData
s@UtteranceData' {} Maybe Int
a -> UtteranceData
s {$sel:distinctUsers:UtteranceData' :: Maybe Int
distinctUsers = Maybe Int
a} :: UtteranceData)

-- | The date that the utterance was first recorded.
utteranceData_firstUtteredDate :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.UTCTime)
utteranceData_firstUtteredDate :: Lens' UtteranceData (Maybe UTCTime)
utteranceData_firstUtteredDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceData' {Maybe POSIX
firstUtteredDate :: Maybe POSIX
$sel:firstUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
firstUtteredDate} -> Maybe POSIX
firstUtteredDate) (\s :: UtteranceData
s@UtteranceData' {} Maybe POSIX
a -> UtteranceData
s {$sel:firstUtteredDate:UtteranceData' :: Maybe POSIX
firstUtteredDate = Maybe POSIX
a} :: UtteranceData) 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 date that the utterance was last recorded.
utteranceData_lastUtteredDate :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.UTCTime)
utteranceData_lastUtteredDate :: Lens' UtteranceData (Maybe UTCTime)
utteranceData_lastUtteredDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceData' {Maybe POSIX
lastUtteredDate :: Maybe POSIX
$sel:lastUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
lastUtteredDate} -> Maybe POSIX
lastUtteredDate) (\s :: UtteranceData
s@UtteranceData' {} Maybe POSIX
a -> UtteranceData
s {$sel:lastUtteredDate:UtteranceData' :: Maybe POSIX
lastUtteredDate = Maybe POSIX
a} :: UtteranceData) 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 text that was entered by the user or the text representation of an
-- audio clip.
utteranceData_utteranceString :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.Text)
utteranceData_utteranceString :: Lens' UtteranceData (Maybe Text)
utteranceData_utteranceString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceData' {Maybe Text
utteranceString :: Maybe Text
$sel:utteranceString:UtteranceData' :: UtteranceData -> Maybe Text
utteranceString} -> Maybe Text
utteranceString) (\s :: UtteranceData
s@UtteranceData' {} Maybe Text
a -> UtteranceData
s {$sel:utteranceString:UtteranceData' :: Maybe Text
utteranceString = Maybe Text
a} :: UtteranceData)

instance Data.FromJSON UtteranceData where
  parseJSON :: Value -> Parser UtteranceData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UtteranceData"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> UtteranceData
UtteranceData'
            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
"count")
            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
"distinctUsers")
            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
"firstUtteredDate")
            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
"lastUtteredDate")
            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
"utteranceString")
      )

instance Prelude.Hashable UtteranceData where
  hashWithSalt :: Int -> UtteranceData -> Int
hashWithSalt Int
_salt UtteranceData' {Maybe Int
Maybe Text
Maybe POSIX
utteranceString :: Maybe Text
lastUtteredDate :: Maybe POSIX
firstUtteredDate :: Maybe POSIX
distinctUsers :: Maybe Int
count :: Maybe Int
$sel:utteranceString:UtteranceData' :: UtteranceData -> Maybe Text
$sel:lastUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
$sel:firstUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
$sel:distinctUsers:UtteranceData' :: UtteranceData -> Maybe Int
$sel:count:UtteranceData' :: UtteranceData -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
distinctUsers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
firstUtteredDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUtteredDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
utteranceString

instance Prelude.NFData UtteranceData where
  rnf :: UtteranceData -> ()
rnf UtteranceData' {Maybe Int
Maybe Text
Maybe POSIX
utteranceString :: Maybe Text
lastUtteredDate :: Maybe POSIX
firstUtteredDate :: Maybe POSIX
distinctUsers :: Maybe Int
count :: Maybe Int
$sel:utteranceString:UtteranceData' :: UtteranceData -> Maybe Text
$sel:lastUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
$sel:firstUtteredDate:UtteranceData' :: UtteranceData -> Maybe POSIX
$sel:distinctUsers:UtteranceData' :: UtteranceData -> Maybe Int
$sel:count:UtteranceData' :: UtteranceData -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
distinctUsers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
firstUtteredDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUtteredDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
utteranceString