{-# 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-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.LexModels.Types.UtteranceData where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 date that the utterance was first recorded.
    UtteranceData -> Maybe POSIX
firstUtteredDate :: Prelude.Maybe Core.POSIX,
    -- | The number of times that the utterance was processed.
    UtteranceData -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The text that was entered by the user or the text representation of an
    -- audio clip.
    UtteranceData -> Maybe Text
utteranceString :: Prelude.Maybe Prelude.Text,
    -- | The date that the utterance was last recorded.
    UtteranceData -> Maybe POSIX
lastUtteredDate :: Prelude.Maybe Core.POSIX,
    -- | The total number of individuals that used the utterance.
    UtteranceData -> Maybe Int
distinctUsers :: Prelude.Maybe Prelude.Int
  }
  deriving (UtteranceData -> UtteranceData -> Bool
(UtteranceData -> UtteranceData -> Bool)
-> (UtteranceData -> UtteranceData -> Bool) -> Eq UtteranceData
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]
(Int -> ReadS UtteranceData)
-> ReadS [UtteranceData]
-> ReadPrec UtteranceData
-> ReadPrec [UtteranceData]
-> Read 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
(Int -> UtteranceData -> ShowS)
-> (UtteranceData -> String)
-> ([UtteranceData] -> ShowS)
-> Show UtteranceData
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. UtteranceData -> Rep UtteranceData x)
-> (forall x. Rep UtteranceData x -> UtteranceData)
-> Generic UtteranceData
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:
--
-- 'firstUtteredDate', 'utteranceData_firstUtteredDate' - The date that the utterance was first recorded.
--
-- 'count', 'utteranceData_count' - The number of times that the utterance was processed.
--
-- 'utteranceString', 'utteranceData_utteranceString' - The text that was entered by the user or the text representation of an
-- audio clip.
--
-- 'lastUtteredDate', 'utteranceData_lastUtteredDate' - The date that the utterance was last recorded.
--
-- 'distinctUsers', 'utteranceData_distinctUsers' - The total number of individuals that used the utterance.
newUtteranceData ::
  UtteranceData
newUtteranceData :: UtteranceData
newUtteranceData =
  UtteranceData' :: Maybe POSIX
-> Maybe Int
-> Maybe Text
-> Maybe POSIX
-> Maybe Int
-> UtteranceData
UtteranceData'
    { $sel:firstUtteredDate:UtteranceData' :: Maybe POSIX
firstUtteredDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:count:UtteranceData' :: Maybe Int
count = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:utteranceString:UtteranceData' :: Maybe Text
utteranceString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUtteredDate:UtteranceData' :: Maybe POSIX
lastUtteredDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:distinctUsers:UtteranceData' :: Maybe Int
distinctUsers = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The date that the utterance was first recorded.
utteranceData_firstUtteredDate :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.UTCTime)
utteranceData_firstUtteredDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> UtteranceData -> f UtteranceData
utteranceData_firstUtteredDate = (UtteranceData -> Maybe POSIX)
-> (UtteranceData -> Maybe POSIX -> UtteranceData)
-> Lens UtteranceData UtteranceData (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> UtteranceData -> f UtteranceData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UtteranceData
-> f UtteranceData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of times that the utterance was processed.
utteranceData_count :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.Int)
utteranceData_count :: (Maybe Int -> f (Maybe Int)) -> UtteranceData -> f UtteranceData
utteranceData_count = (UtteranceData -> Maybe Int)
-> (UtteranceData -> Maybe Int -> UtteranceData)
-> Lens UtteranceData UtteranceData (Maybe Int) (Maybe Int)
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 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 :: (Maybe Text -> f (Maybe Text)) -> UtteranceData -> f UtteranceData
utteranceData_utteranceString = (UtteranceData -> Maybe Text)
-> (UtteranceData -> Maybe Text -> UtteranceData)
-> Lens UtteranceData UtteranceData (Maybe Text) (Maybe Text)
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)

-- | The date that the utterance was last recorded.
utteranceData_lastUtteredDate :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.UTCTime)
utteranceData_lastUtteredDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> UtteranceData -> f UtteranceData
utteranceData_lastUtteredDate = (UtteranceData -> Maybe POSIX)
-> (UtteranceData -> Maybe POSIX -> UtteranceData)
-> Lens UtteranceData UtteranceData (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> UtteranceData -> f UtteranceData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UtteranceData
-> f UtteranceData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The total number of individuals that used the utterance.
utteranceData_distinctUsers :: Lens.Lens' UtteranceData (Prelude.Maybe Prelude.Int)
utteranceData_distinctUsers :: (Maybe Int -> f (Maybe Int)) -> UtteranceData -> f UtteranceData
utteranceData_distinctUsers = (UtteranceData -> Maybe Int)
-> (UtteranceData -> Maybe Int -> UtteranceData)
-> Lens UtteranceData UtteranceData (Maybe Int) (Maybe Int)
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)

instance Core.FromJSON UtteranceData where
  parseJSON :: Value -> Parser UtteranceData
parseJSON =
    String
-> (Object -> Parser UtteranceData)
-> Value
-> Parser UtteranceData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UtteranceData"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Int
-> Maybe Text
-> Maybe POSIX
-> Maybe Int
-> UtteranceData
UtteranceData'
            (Maybe POSIX
 -> Maybe Int
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Int
 -> UtteranceData)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe POSIX -> Maybe Int -> UtteranceData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"firstUtteredDate")
            Parser
  (Maybe Int
   -> Maybe Text -> Maybe POSIX -> Maybe Int -> UtteranceData)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Int -> UtteranceData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"count")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Int -> UtteranceData)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Int -> UtteranceData)
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
"utteranceString")
            Parser (Maybe POSIX -> Maybe Int -> UtteranceData)
-> Parser (Maybe POSIX) -> Parser (Maybe Int -> UtteranceData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUtteredDate")
            Parser (Maybe Int -> UtteranceData)
-> Parser (Maybe Int) -> Parser UtteranceData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"distinctUsers")
      )

instance Prelude.Hashable UtteranceData

instance Prelude.NFData UtteranceData