{-# 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.LexRuntime.Types.ActiveContextTimeToLive 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 ActiveContextTimeToLive = ActiveContextTimeToLive'
{
ActiveContextTimeToLive -> Maybe Natural
timeToLiveInSeconds :: Prelude.Maybe Prelude.Natural,
ActiveContextTimeToLive -> Maybe Natural
turnsToLive :: Prelude.Maybe Prelude.Natural
}
deriving (ActiveContextTimeToLive -> ActiveContextTimeToLive -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActiveContextTimeToLive -> ActiveContextTimeToLive -> Bool
$c/= :: ActiveContextTimeToLive -> ActiveContextTimeToLive -> Bool
== :: ActiveContextTimeToLive -> ActiveContextTimeToLive -> Bool
$c== :: ActiveContextTimeToLive -> ActiveContextTimeToLive -> Bool
Prelude.Eq, ReadPrec [ActiveContextTimeToLive]
ReadPrec ActiveContextTimeToLive
Int -> ReadS ActiveContextTimeToLive
ReadS [ActiveContextTimeToLive]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActiveContextTimeToLive]
$creadListPrec :: ReadPrec [ActiveContextTimeToLive]
readPrec :: ReadPrec ActiveContextTimeToLive
$creadPrec :: ReadPrec ActiveContextTimeToLive
readList :: ReadS [ActiveContextTimeToLive]
$creadList :: ReadS [ActiveContextTimeToLive]
readsPrec :: Int -> ReadS ActiveContextTimeToLive
$creadsPrec :: Int -> ReadS ActiveContextTimeToLive
Prelude.Read, Int -> ActiveContextTimeToLive -> ShowS
[ActiveContextTimeToLive] -> ShowS
ActiveContextTimeToLive -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActiveContextTimeToLive] -> ShowS
$cshowList :: [ActiveContextTimeToLive] -> ShowS
show :: ActiveContextTimeToLive -> String
$cshow :: ActiveContextTimeToLive -> String
showsPrec :: Int -> ActiveContextTimeToLive -> ShowS
$cshowsPrec :: Int -> ActiveContextTimeToLive -> ShowS
Prelude.Show, forall x. Rep ActiveContextTimeToLive x -> ActiveContextTimeToLive
forall x. ActiveContextTimeToLive -> Rep ActiveContextTimeToLive x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActiveContextTimeToLive x -> ActiveContextTimeToLive
$cfrom :: forall x. ActiveContextTimeToLive -> Rep ActiveContextTimeToLive x
Prelude.Generic)
newActiveContextTimeToLive ::
ActiveContextTimeToLive
newActiveContextTimeToLive :: ActiveContextTimeToLive
newActiveContextTimeToLive =
ActiveContextTimeToLive'
{ $sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: Maybe Natural
timeToLiveInSeconds =
forall a. Maybe a
Prelude.Nothing,
$sel:turnsToLive:ActiveContextTimeToLive' :: Maybe Natural
turnsToLive = forall a. Maybe a
Prelude.Nothing
}
activeContextTimeToLive_timeToLiveInSeconds :: Lens.Lens' ActiveContextTimeToLive (Prelude.Maybe Prelude.Natural)
activeContextTimeToLive_timeToLiveInSeconds :: Lens' ActiveContextTimeToLive (Maybe Natural)
activeContextTimeToLive_timeToLiveInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveContextTimeToLive' {Maybe Natural
timeToLiveInSeconds :: Maybe Natural
$sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
timeToLiveInSeconds} -> Maybe Natural
timeToLiveInSeconds) (\s :: ActiveContextTimeToLive
s@ActiveContextTimeToLive' {} Maybe Natural
a -> ActiveContextTimeToLive
s {$sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: Maybe Natural
timeToLiveInSeconds = Maybe Natural
a} :: ActiveContextTimeToLive)
activeContextTimeToLive_turnsToLive :: Lens.Lens' ActiveContextTimeToLive (Prelude.Maybe Prelude.Natural)
activeContextTimeToLive_turnsToLive :: Lens' ActiveContextTimeToLive (Maybe Natural)
activeContextTimeToLive_turnsToLive = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveContextTimeToLive' {Maybe Natural
turnsToLive :: Maybe Natural
$sel:turnsToLive:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
turnsToLive} -> Maybe Natural
turnsToLive) (\s :: ActiveContextTimeToLive
s@ActiveContextTimeToLive' {} Maybe Natural
a -> ActiveContextTimeToLive
s {$sel:turnsToLive:ActiveContextTimeToLive' :: Maybe Natural
turnsToLive = Maybe Natural
a} :: ActiveContextTimeToLive)
instance Data.FromJSON ActiveContextTimeToLive where
parseJSON :: Value -> Parser ActiveContextTimeToLive
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ActiveContextTimeToLive"
( \Object
x ->
Maybe Natural -> Maybe Natural -> ActiveContextTimeToLive
ActiveContextTimeToLive'
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
"timeToLiveInSeconds")
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
"turnsToLive")
)
instance Prelude.Hashable ActiveContextTimeToLive where
hashWithSalt :: Int -> ActiveContextTimeToLive -> Int
hashWithSalt Int
_salt ActiveContextTimeToLive' {Maybe Natural
turnsToLive :: Maybe Natural
timeToLiveInSeconds :: Maybe Natural
$sel:turnsToLive:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
$sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
timeToLiveInSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
turnsToLive
instance Prelude.NFData ActiveContextTimeToLive where
rnf :: ActiveContextTimeToLive -> ()
rnf ActiveContextTimeToLive' {Maybe Natural
turnsToLive :: Maybe Natural
timeToLiveInSeconds :: Maybe Natural
$sel:turnsToLive:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
$sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
timeToLiveInSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
turnsToLive
instance Data.ToJSON ActiveContextTimeToLive where
toJSON :: ActiveContextTimeToLive -> Value
toJSON ActiveContextTimeToLive' {Maybe Natural
turnsToLive :: Maybe Natural
timeToLiveInSeconds :: Maybe Natural
$sel:turnsToLive:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
$sel:timeToLiveInSeconds:ActiveContextTimeToLive' :: ActiveContextTimeToLive -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"timeToLiveInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeToLiveInSeconds,
(Key
"turnsToLive" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
turnsToLive
]
)