{-# 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.QuietTime where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data QuietTime = QuietTime'
{
QuietTime -> Maybe Text
start :: Prelude.Maybe Prelude.Text,
QuietTime -> Maybe Text
end :: Prelude.Maybe Prelude.Text
}
deriving (QuietTime -> QuietTime -> Bool
(QuietTime -> QuietTime -> Bool)
-> (QuietTime -> QuietTime -> Bool) -> Eq QuietTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QuietTime -> QuietTime -> Bool
$c/= :: QuietTime -> QuietTime -> Bool
== :: QuietTime -> QuietTime -> Bool
$c== :: QuietTime -> QuietTime -> Bool
Prelude.Eq, ReadPrec [QuietTime]
ReadPrec QuietTime
Int -> ReadS QuietTime
ReadS [QuietTime]
(Int -> ReadS QuietTime)
-> ReadS [QuietTime]
-> ReadPrec QuietTime
-> ReadPrec [QuietTime]
-> Read QuietTime
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QuietTime]
$creadListPrec :: ReadPrec [QuietTime]
readPrec :: ReadPrec QuietTime
$creadPrec :: ReadPrec QuietTime
readList :: ReadS [QuietTime]
$creadList :: ReadS [QuietTime]
readsPrec :: Int -> ReadS QuietTime
$creadsPrec :: Int -> ReadS QuietTime
Prelude.Read, Int -> QuietTime -> ShowS
[QuietTime] -> ShowS
QuietTime -> String
(Int -> QuietTime -> ShowS)
-> (QuietTime -> String)
-> ([QuietTime] -> ShowS)
-> Show QuietTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QuietTime] -> ShowS
$cshowList :: [QuietTime] -> ShowS
show :: QuietTime -> String
$cshow :: QuietTime -> String
showsPrec :: Int -> QuietTime -> ShowS
$cshowsPrec :: Int -> QuietTime -> ShowS
Prelude.Show, (forall x. QuietTime -> Rep QuietTime x)
-> (forall x. Rep QuietTime x -> QuietTime) -> Generic QuietTime
forall x. Rep QuietTime x -> QuietTime
forall x. QuietTime -> Rep QuietTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QuietTime x -> QuietTime
$cfrom :: forall x. QuietTime -> Rep QuietTime x
Prelude.Generic)
newQuietTime ::
QuietTime
newQuietTime :: QuietTime
newQuietTime =
QuietTime' :: Maybe Text -> Maybe Text -> QuietTime
QuietTime'
{ $sel:start:QuietTime' :: Maybe Text
start = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:end:QuietTime' :: Maybe Text
end = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
quietTime_start :: Lens.Lens' QuietTime (Prelude.Maybe Prelude.Text)
quietTime_start :: (Maybe Text -> f (Maybe Text)) -> QuietTime -> f QuietTime
quietTime_start = (QuietTime -> Maybe Text)
-> (QuietTime -> Maybe Text -> QuietTime)
-> Lens QuietTime QuietTime (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QuietTime' {Maybe Text
start :: Maybe Text
$sel:start:QuietTime' :: QuietTime -> Maybe Text
start} -> Maybe Text
start) (\s :: QuietTime
s@QuietTime' {} Maybe Text
a -> QuietTime
s {$sel:start:QuietTime' :: Maybe Text
start = Maybe Text
a} :: QuietTime)
quietTime_end :: Lens.Lens' QuietTime (Prelude.Maybe Prelude.Text)
quietTime_end :: (Maybe Text -> f (Maybe Text)) -> QuietTime -> f QuietTime
quietTime_end = (QuietTime -> Maybe Text)
-> (QuietTime -> Maybe Text -> QuietTime)
-> Lens QuietTime QuietTime (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QuietTime' {Maybe Text
end :: Maybe Text
$sel:end:QuietTime' :: QuietTime -> Maybe Text
end} -> Maybe Text
end) (\s :: QuietTime
s@QuietTime' {} Maybe Text
a -> QuietTime
s {$sel:end:QuietTime' :: Maybe Text
end = Maybe Text
a} :: QuietTime)
instance Core.FromJSON QuietTime where
parseJSON :: Value -> Parser QuietTime
parseJSON =
String -> (Object -> Parser QuietTime) -> Value -> Parser QuietTime
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"QuietTime"
( \Object
x ->
Maybe Text -> Maybe Text -> QuietTime
QuietTime'
(Maybe Text -> Maybe Text -> QuietTime)
-> Parser (Maybe Text) -> Parser (Maybe Text -> QuietTime)
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
"Start") Parser (Maybe Text -> QuietTime)
-> Parser (Maybe Text) -> Parser QuietTime
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
"End")
)
instance Prelude.Hashable QuietTime
instance Prelude.NFData QuietTime
instance Core.ToJSON QuietTime where
toJSON :: QuietTime -> Value
toJSON QuietTime' {Maybe Text
end :: Maybe Text
start :: Maybe Text
$sel:end:QuietTime' :: QuietTime -> Maybe Text
$sel:start:QuietTime' :: QuietTime -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Start" 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
start,
(Text
"End" 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
end
]
)