{-# 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 #-}
module Amazonka.LexModels.Types.OutputContext where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OutputContext = OutputContext'
{
OutputContext -> Text
name :: Prelude.Text,
OutputContext -> Natural
timeToLiveInSeconds :: Prelude.Natural,
OutputContext -> Natural
turnsToLive :: Prelude.Natural
}
deriving (OutputContext -> OutputContext -> Bool
(OutputContext -> OutputContext -> Bool)
-> (OutputContext -> OutputContext -> Bool) -> Eq OutputContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputContext -> OutputContext -> Bool
$c/= :: OutputContext -> OutputContext -> Bool
== :: OutputContext -> OutputContext -> Bool
$c== :: OutputContext -> OutputContext -> Bool
Prelude.Eq, ReadPrec [OutputContext]
ReadPrec OutputContext
Int -> ReadS OutputContext
ReadS [OutputContext]
(Int -> ReadS OutputContext)
-> ReadS [OutputContext]
-> ReadPrec OutputContext
-> ReadPrec [OutputContext]
-> Read OutputContext
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputContext]
$creadListPrec :: ReadPrec [OutputContext]
readPrec :: ReadPrec OutputContext
$creadPrec :: ReadPrec OutputContext
readList :: ReadS [OutputContext]
$creadList :: ReadS [OutputContext]
readsPrec :: Int -> ReadS OutputContext
$creadsPrec :: Int -> ReadS OutputContext
Prelude.Read, Int -> OutputContext -> ShowS
[OutputContext] -> ShowS
OutputContext -> String
(Int -> OutputContext -> ShowS)
-> (OutputContext -> String)
-> ([OutputContext] -> ShowS)
-> Show OutputContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputContext] -> ShowS
$cshowList :: [OutputContext] -> ShowS
show :: OutputContext -> String
$cshow :: OutputContext -> String
showsPrec :: Int -> OutputContext -> ShowS
$cshowsPrec :: Int -> OutputContext -> ShowS
Prelude.Show, (forall x. OutputContext -> Rep OutputContext x)
-> (forall x. Rep OutputContext x -> OutputContext)
-> Generic OutputContext
forall x. Rep OutputContext x -> OutputContext
forall x. OutputContext -> Rep OutputContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputContext x -> OutputContext
$cfrom :: forall x. OutputContext -> Rep OutputContext x
Prelude.Generic)
newOutputContext ::
Prelude.Text ->
Prelude.Natural ->
Prelude.Natural ->
OutputContext
newOutputContext :: Text -> Natural -> Natural -> OutputContext
newOutputContext
Text
pName_
Natural
pTimeToLiveInSeconds_
Natural
pTurnsToLive_ =
OutputContext' :: Text -> Natural -> Natural -> OutputContext
OutputContext'
{ $sel:name:OutputContext' :: Text
name = Text
pName_,
$sel:timeToLiveInSeconds:OutputContext' :: Natural
timeToLiveInSeconds = Natural
pTimeToLiveInSeconds_,
$sel:turnsToLive:OutputContext' :: Natural
turnsToLive = Natural
pTurnsToLive_
}
outputContext_name :: Lens.Lens' OutputContext Prelude.Text
outputContext_name :: (Text -> f Text) -> OutputContext -> f OutputContext
outputContext_name = (OutputContext -> Text)
-> (OutputContext -> Text -> OutputContext)
-> Lens OutputContext OutputContext Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputContext' {Text
name :: Text
$sel:name:OutputContext' :: OutputContext -> Text
name} -> Text
name) (\s :: OutputContext
s@OutputContext' {} Text
a -> OutputContext
s {$sel:name:OutputContext' :: Text
name = Text
a} :: OutputContext)
outputContext_timeToLiveInSeconds :: Lens.Lens' OutputContext Prelude.Natural
outputContext_timeToLiveInSeconds :: (Natural -> f Natural) -> OutputContext -> f OutputContext
outputContext_timeToLiveInSeconds = (OutputContext -> Natural)
-> (OutputContext -> Natural -> OutputContext)
-> Lens OutputContext OutputContext Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputContext' {Natural
timeToLiveInSeconds :: Natural
$sel:timeToLiveInSeconds:OutputContext' :: OutputContext -> Natural
timeToLiveInSeconds} -> Natural
timeToLiveInSeconds) (\s :: OutputContext
s@OutputContext' {} Natural
a -> OutputContext
s {$sel:timeToLiveInSeconds:OutputContext' :: Natural
timeToLiveInSeconds = Natural
a} :: OutputContext)
outputContext_turnsToLive :: Lens.Lens' OutputContext Prelude.Natural
outputContext_turnsToLive :: (Natural -> f Natural) -> OutputContext -> f OutputContext
outputContext_turnsToLive = (OutputContext -> Natural)
-> (OutputContext -> Natural -> OutputContext)
-> Lens OutputContext OutputContext Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputContext' {Natural
turnsToLive :: Natural
$sel:turnsToLive:OutputContext' :: OutputContext -> Natural
turnsToLive} -> Natural
turnsToLive) (\s :: OutputContext
s@OutputContext' {} Natural
a -> OutputContext
s {$sel:turnsToLive:OutputContext' :: Natural
turnsToLive = Natural
a} :: OutputContext)
instance Core.FromJSON OutputContext where
parseJSON :: Value -> Parser OutputContext
parseJSON =
String
-> (Object -> Parser OutputContext)
-> Value
-> Parser OutputContext
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OutputContext"
( \Object
x ->
Text -> Natural -> Natural -> OutputContext
OutputContext'
(Text -> Natural -> Natural -> OutputContext)
-> Parser Text -> Parser (Natural -> Natural -> OutputContext)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
Parser (Natural -> Natural -> OutputContext)
-> Parser Natural -> Parser (Natural -> OutputContext)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timeToLiveInSeconds")
Parser (Natural -> OutputContext)
-> Parser Natural -> Parser OutputContext
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"turnsToLive")
)
instance Prelude.Hashable OutputContext
instance Prelude.NFData OutputContext
instance Core.ToJSON OutputContext where
toJSON :: OutputContext -> Value
toJSON OutputContext' {Natural
Text
turnsToLive :: Natural
timeToLiveInSeconds :: Natural
name :: Text
$sel:turnsToLive:OutputContext' :: OutputContext -> Natural
$sel:timeToLiveInSeconds:OutputContext' :: OutputContext -> Natural
$sel:name:OutputContext' :: OutputContext -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"timeToLiveInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
timeToLiveInSeconds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"turnsToLive" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
turnsToLive)
]
)