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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.UtteranceData
import qualified Amazonka.Prelude as Prelude

-- | Provides a list of utterances that have been made to a specific version
-- of your bot. The list contains a maximum of 100 utterances.
--
-- /See:/ 'newUtteranceList' smart constructor.
data UtteranceList = UtteranceList'
  { -- | The version of the bot that processed the list.
    UtteranceList -> Maybe Text
botVersion :: Prelude.Maybe Prelude.Text,
    -- | One or more UtteranceData objects that contain information about the
    -- utterances that have been made to a bot. The maximum number of object is
    -- 100.
    UtteranceList -> Maybe [UtteranceData]
utterances :: Prelude.Maybe [UtteranceData]
  }
  deriving (UtteranceList -> UtteranceList -> Bool
(UtteranceList -> UtteranceList -> Bool)
-> (UtteranceList -> UtteranceList -> Bool) -> Eq UtteranceList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UtteranceList -> UtteranceList -> Bool
$c/= :: UtteranceList -> UtteranceList -> Bool
== :: UtteranceList -> UtteranceList -> Bool
$c== :: UtteranceList -> UtteranceList -> Bool
Prelude.Eq, ReadPrec [UtteranceList]
ReadPrec UtteranceList
Int -> ReadS UtteranceList
ReadS [UtteranceList]
(Int -> ReadS UtteranceList)
-> ReadS [UtteranceList]
-> ReadPrec UtteranceList
-> ReadPrec [UtteranceList]
-> Read UtteranceList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UtteranceList]
$creadListPrec :: ReadPrec [UtteranceList]
readPrec :: ReadPrec UtteranceList
$creadPrec :: ReadPrec UtteranceList
readList :: ReadS [UtteranceList]
$creadList :: ReadS [UtteranceList]
readsPrec :: Int -> ReadS UtteranceList
$creadsPrec :: Int -> ReadS UtteranceList
Prelude.Read, Int -> UtteranceList -> ShowS
[UtteranceList] -> ShowS
UtteranceList -> String
(Int -> UtteranceList -> ShowS)
-> (UtteranceList -> String)
-> ([UtteranceList] -> ShowS)
-> Show UtteranceList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UtteranceList] -> ShowS
$cshowList :: [UtteranceList] -> ShowS
show :: UtteranceList -> String
$cshow :: UtteranceList -> String
showsPrec :: Int -> UtteranceList -> ShowS
$cshowsPrec :: Int -> UtteranceList -> ShowS
Prelude.Show, (forall x. UtteranceList -> Rep UtteranceList x)
-> (forall x. Rep UtteranceList x -> UtteranceList)
-> Generic UtteranceList
forall x. Rep UtteranceList x -> UtteranceList
forall x. UtteranceList -> Rep UtteranceList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UtteranceList x -> UtteranceList
$cfrom :: forall x. UtteranceList -> Rep UtteranceList x
Prelude.Generic)

-- |
-- Create a value of 'UtteranceList' 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:
--
-- 'botVersion', 'utteranceList_botVersion' - The version of the bot that processed the list.
--
-- 'utterances', 'utteranceList_utterances' - One or more UtteranceData objects that contain information about the
-- utterances that have been made to a bot. The maximum number of object is
-- 100.
newUtteranceList ::
  UtteranceList
newUtteranceList :: UtteranceList
newUtteranceList =
  UtteranceList' :: Maybe Text -> Maybe [UtteranceData] -> UtteranceList
UtteranceList'
    { $sel:botVersion:UtteranceList' :: Maybe Text
botVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:utterances:UtteranceList' :: Maybe [UtteranceData]
utterances = Maybe [UtteranceData]
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the bot that processed the list.
utteranceList_botVersion :: Lens.Lens' UtteranceList (Prelude.Maybe Prelude.Text)
utteranceList_botVersion :: (Maybe Text -> f (Maybe Text)) -> UtteranceList -> f UtteranceList
utteranceList_botVersion = (UtteranceList -> Maybe Text)
-> (UtteranceList -> Maybe Text -> UtteranceList)
-> Lens UtteranceList UtteranceList (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceList' {Maybe Text
botVersion :: Maybe Text
$sel:botVersion:UtteranceList' :: UtteranceList -> Maybe Text
botVersion} -> Maybe Text
botVersion) (\s :: UtteranceList
s@UtteranceList' {} Maybe Text
a -> UtteranceList
s {$sel:botVersion:UtteranceList' :: Maybe Text
botVersion = Maybe Text
a} :: UtteranceList)

-- | One or more UtteranceData objects that contain information about the
-- utterances that have been made to a bot. The maximum number of object is
-- 100.
utteranceList_utterances :: Lens.Lens' UtteranceList (Prelude.Maybe [UtteranceData])
utteranceList_utterances :: (Maybe [UtteranceData] -> f (Maybe [UtteranceData]))
-> UtteranceList -> f UtteranceList
utteranceList_utterances = (UtteranceList -> Maybe [UtteranceData])
-> (UtteranceList -> Maybe [UtteranceData] -> UtteranceList)
-> Lens
     UtteranceList
     UtteranceList
     (Maybe [UtteranceData])
     (Maybe [UtteranceData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtteranceList' {Maybe [UtteranceData]
utterances :: Maybe [UtteranceData]
$sel:utterances:UtteranceList' :: UtteranceList -> Maybe [UtteranceData]
utterances} -> Maybe [UtteranceData]
utterances) (\s :: UtteranceList
s@UtteranceList' {} Maybe [UtteranceData]
a -> UtteranceList
s {$sel:utterances:UtteranceList' :: Maybe [UtteranceData]
utterances = Maybe [UtteranceData]
a} :: UtteranceList) ((Maybe [UtteranceData] -> f (Maybe [UtteranceData]))
 -> UtteranceList -> f UtteranceList)
-> ((Maybe [UtteranceData] -> f (Maybe [UtteranceData]))
    -> Maybe [UtteranceData] -> f (Maybe [UtteranceData]))
-> (Maybe [UtteranceData] -> f (Maybe [UtteranceData]))
-> UtteranceList
-> f UtteranceList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UtteranceData] [UtteranceData] [UtteranceData] [UtteranceData]
-> Iso
     (Maybe [UtteranceData])
     (Maybe [UtteranceData])
     (Maybe [UtteranceData])
     (Maybe [UtteranceData])
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
  [UtteranceData] [UtteranceData] [UtteranceData] [UtteranceData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON UtteranceList where
  parseJSON :: Value -> Parser UtteranceList
parseJSON =
    String
-> (Object -> Parser UtteranceList)
-> Value
-> Parser UtteranceList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UtteranceList"
      ( \Object
x ->
          Maybe Text -> Maybe [UtteranceData] -> UtteranceList
UtteranceList'
            (Maybe Text -> Maybe [UtteranceData] -> UtteranceList)
-> Parser (Maybe Text)
-> Parser (Maybe [UtteranceData] -> UtteranceList)
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
"botVersion")
            Parser (Maybe [UtteranceData] -> UtteranceList)
-> Parser (Maybe [UtteranceData]) -> Parser UtteranceList
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [UtteranceData]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"utterances" Parser (Maybe (Maybe [UtteranceData]))
-> Maybe [UtteranceData] -> Parser (Maybe [UtteranceData])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [UtteranceData]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable UtteranceList

instance Prelude.NFData UtteranceList