{-# 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.Pinpoint.Types.WaitTime where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data WaitTime = WaitTime'
{
WaitTime -> Maybe Text
waitFor :: Prelude.Maybe Prelude.Text,
WaitTime -> Maybe Text
waitUntil :: Prelude.Maybe Prelude.Text
}
deriving (WaitTime -> WaitTime -> Bool
(WaitTime -> WaitTime -> Bool)
-> (WaitTime -> WaitTime -> Bool) -> Eq WaitTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WaitTime -> WaitTime -> Bool
$c/= :: WaitTime -> WaitTime -> Bool
== :: WaitTime -> WaitTime -> Bool
$c== :: WaitTime -> WaitTime -> Bool
Prelude.Eq, ReadPrec [WaitTime]
ReadPrec WaitTime
Int -> ReadS WaitTime
ReadS [WaitTime]
(Int -> ReadS WaitTime)
-> ReadS [WaitTime]
-> ReadPrec WaitTime
-> ReadPrec [WaitTime]
-> Read WaitTime
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WaitTime]
$creadListPrec :: ReadPrec [WaitTime]
readPrec :: ReadPrec WaitTime
$creadPrec :: ReadPrec WaitTime
readList :: ReadS [WaitTime]
$creadList :: ReadS [WaitTime]
readsPrec :: Int -> ReadS WaitTime
$creadsPrec :: Int -> ReadS WaitTime
Prelude.Read, Int -> WaitTime -> ShowS
[WaitTime] -> ShowS
WaitTime -> String
(Int -> WaitTime -> ShowS)
-> (WaitTime -> String) -> ([WaitTime] -> ShowS) -> Show WaitTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WaitTime] -> ShowS
$cshowList :: [WaitTime] -> ShowS
show :: WaitTime -> String
$cshow :: WaitTime -> String
showsPrec :: Int -> WaitTime -> ShowS
$cshowsPrec :: Int -> WaitTime -> ShowS
Prelude.Show, (forall x. WaitTime -> Rep WaitTime x)
-> (forall x. Rep WaitTime x -> WaitTime) -> Generic WaitTime
forall x. Rep WaitTime x -> WaitTime
forall x. WaitTime -> Rep WaitTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WaitTime x -> WaitTime
$cfrom :: forall x. WaitTime -> Rep WaitTime x
Prelude.Generic)
newWaitTime ::
WaitTime
newWaitTime :: WaitTime
newWaitTime =
WaitTime' :: Maybe Text -> Maybe Text -> WaitTime
WaitTime'
{ $sel:waitFor:WaitTime' :: Maybe Text
waitFor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:waitUntil:WaitTime' :: Maybe Text
waitUntil = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
waitTime_waitFor :: Lens.Lens' WaitTime (Prelude.Maybe Prelude.Text)
waitTime_waitFor :: (Maybe Text -> f (Maybe Text)) -> WaitTime -> f WaitTime
waitTime_waitFor = (WaitTime -> Maybe Text)
-> (WaitTime -> Maybe Text -> WaitTime)
-> Lens WaitTime WaitTime (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WaitTime' {Maybe Text
waitFor :: Maybe Text
$sel:waitFor:WaitTime' :: WaitTime -> Maybe Text
waitFor} -> Maybe Text
waitFor) (\s :: WaitTime
s@WaitTime' {} Maybe Text
a -> WaitTime
s {$sel:waitFor:WaitTime' :: Maybe Text
waitFor = Maybe Text
a} :: WaitTime)
waitTime_waitUntil :: Lens.Lens' WaitTime (Prelude.Maybe Prelude.Text)
waitTime_waitUntil :: (Maybe Text -> f (Maybe Text)) -> WaitTime -> f WaitTime
waitTime_waitUntil = (WaitTime -> Maybe Text)
-> (WaitTime -> Maybe Text -> WaitTime)
-> Lens WaitTime WaitTime (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WaitTime' {Maybe Text
waitUntil :: Maybe Text
$sel:waitUntil:WaitTime' :: WaitTime -> Maybe Text
waitUntil} -> Maybe Text
waitUntil) (\s :: WaitTime
s@WaitTime' {} Maybe Text
a -> WaitTime
s {$sel:waitUntil:WaitTime' :: Maybe Text
waitUntil = Maybe Text
a} :: WaitTime)
instance Core.FromJSON WaitTime where
parseJSON :: Value -> Parser WaitTime
parseJSON =
String -> (Object -> Parser WaitTime) -> Value -> Parser WaitTime
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"WaitTime"
( \Object
x ->
Maybe Text -> Maybe Text -> WaitTime
WaitTime'
(Maybe Text -> Maybe Text -> WaitTime)
-> Parser (Maybe Text) -> Parser (Maybe Text -> WaitTime)
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
"WaitFor")
Parser (Maybe Text -> WaitTime)
-> Parser (Maybe Text) -> Parser WaitTime
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
"WaitUntil")
)
instance Prelude.Hashable WaitTime
instance Prelude.NFData WaitTime
instance Core.ToJSON WaitTime where
toJSON :: WaitTime -> Value
toJSON WaitTime' {Maybe Text
waitUntil :: Maybe Text
waitFor :: Maybe Text
$sel:waitUntil:WaitTime' :: WaitTime -> Maybe Text
$sel:waitFor:WaitTime' :: WaitTime -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"WaitFor" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
waitFor,
(Text
"WaitUntil" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
waitUntil
]
)