{-# 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.LexV2Models.Types.OutputContext 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
data OutputContext = OutputContext'
{
OutputContext -> Text
name :: Prelude.Text,
OutputContext -> Natural
timeToLiveInSeconds :: Prelude.Natural,
OutputContext -> Natural
turnsToLive :: Prelude.Natural
}
deriving (OutputContext -> OutputContext -> Bool
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]
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
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. 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'
{ $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 :: Lens' OutputContext Text
outputContext_name = 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 :: Lens' OutputContext Natural
outputContext_timeToLiveInSeconds = 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 :: Lens' OutputContext Natural
outputContext_turnsToLive = 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 Data.FromJSON OutputContext where
parseJSON :: Value -> Parser OutputContext
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"OutputContext"
( \Object
x ->
Text -> Natural -> Natural -> OutputContext
OutputContext'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timeToLiveInSeconds")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"turnsToLive")
)
instance Prelude.Hashable OutputContext where
hashWithSalt :: Int -> OutputContext -> Int
hashWithSalt Int
_salt OutputContext' {Natural
Text
turnsToLive :: Natural
timeToLiveInSeconds :: Natural
name :: Text
$sel:turnsToLive:OutputContext' :: OutputContext -> Natural
$sel:timeToLiveInSeconds:OutputContext' :: OutputContext -> Natural
$sel:name:OutputContext' :: OutputContext -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
timeToLiveInSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
turnsToLive
instance Prelude.NFData OutputContext where
rnf :: OutputContext -> ()
rnf OutputContext' {Natural
Text
turnsToLive :: Natural
timeToLiveInSeconds :: Natural
name :: Text
$sel:turnsToLive:OutputContext' :: OutputContext -> Natural
$sel:timeToLiveInSeconds:OutputContext' :: OutputContext -> Natural
$sel:name:OutputContext' :: OutputContext -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
timeToLiveInSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
turnsToLive
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just
(Key
"timeToLiveInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
timeToLiveInSeconds),
forall a. a -> Maybe a
Prelude.Just (Key
"turnsToLive" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
turnsToLive)
]
)