{-# 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.MQ.Types.WeeklyStartTime where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types.DayOfWeek
import qualified Amazonka.Prelude as Prelude
data WeeklyStartTime = WeeklyStartTime'
{
WeeklyStartTime -> Maybe Text
timeZone :: Prelude.Maybe Prelude.Text,
WeeklyStartTime -> Text
timeOfDay :: Prelude.Text,
WeeklyStartTime -> DayOfWeek
dayOfWeek :: DayOfWeek
}
deriving (WeeklyStartTime -> WeeklyStartTime -> Bool
(WeeklyStartTime -> WeeklyStartTime -> Bool)
-> (WeeklyStartTime -> WeeklyStartTime -> Bool)
-> Eq WeeklyStartTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WeeklyStartTime -> WeeklyStartTime -> Bool
$c/= :: WeeklyStartTime -> WeeklyStartTime -> Bool
== :: WeeklyStartTime -> WeeklyStartTime -> Bool
$c== :: WeeklyStartTime -> WeeklyStartTime -> Bool
Prelude.Eq, ReadPrec [WeeklyStartTime]
ReadPrec WeeklyStartTime
Int -> ReadS WeeklyStartTime
ReadS [WeeklyStartTime]
(Int -> ReadS WeeklyStartTime)
-> ReadS [WeeklyStartTime]
-> ReadPrec WeeklyStartTime
-> ReadPrec [WeeklyStartTime]
-> Read WeeklyStartTime
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WeeklyStartTime]
$creadListPrec :: ReadPrec [WeeklyStartTime]
readPrec :: ReadPrec WeeklyStartTime
$creadPrec :: ReadPrec WeeklyStartTime
readList :: ReadS [WeeklyStartTime]
$creadList :: ReadS [WeeklyStartTime]
readsPrec :: Int -> ReadS WeeklyStartTime
$creadsPrec :: Int -> ReadS WeeklyStartTime
Prelude.Read, Int -> WeeklyStartTime -> ShowS
[WeeklyStartTime] -> ShowS
WeeklyStartTime -> String
(Int -> WeeklyStartTime -> ShowS)
-> (WeeklyStartTime -> String)
-> ([WeeklyStartTime] -> ShowS)
-> Show WeeklyStartTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WeeklyStartTime] -> ShowS
$cshowList :: [WeeklyStartTime] -> ShowS
show :: WeeklyStartTime -> String
$cshow :: WeeklyStartTime -> String
showsPrec :: Int -> WeeklyStartTime -> ShowS
$cshowsPrec :: Int -> WeeklyStartTime -> ShowS
Prelude.Show, (forall x. WeeklyStartTime -> Rep WeeklyStartTime x)
-> (forall x. Rep WeeklyStartTime x -> WeeklyStartTime)
-> Generic WeeklyStartTime
forall x. Rep WeeklyStartTime x -> WeeklyStartTime
forall x. WeeklyStartTime -> Rep WeeklyStartTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WeeklyStartTime x -> WeeklyStartTime
$cfrom :: forall x. WeeklyStartTime -> Rep WeeklyStartTime x
Prelude.Generic)
newWeeklyStartTime ::
Prelude.Text ->
DayOfWeek ->
WeeklyStartTime
newWeeklyStartTime :: Text -> DayOfWeek -> WeeklyStartTime
newWeeklyStartTime Text
pTimeOfDay_ DayOfWeek
pDayOfWeek_ =
WeeklyStartTime' :: Maybe Text -> Text -> DayOfWeek -> WeeklyStartTime
WeeklyStartTime'
{ $sel:timeZone:WeeklyStartTime' :: Maybe Text
timeZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timeOfDay:WeeklyStartTime' :: Text
timeOfDay = Text
pTimeOfDay_,
$sel:dayOfWeek:WeeklyStartTime' :: DayOfWeek
dayOfWeek = DayOfWeek
pDayOfWeek_
}
weeklyStartTime_timeZone :: Lens.Lens' WeeklyStartTime (Prelude.Maybe Prelude.Text)
weeklyStartTime_timeZone :: (Maybe Text -> f (Maybe Text))
-> WeeklyStartTime -> f WeeklyStartTime
weeklyStartTime_timeZone = (WeeklyStartTime -> Maybe Text)
-> (WeeklyStartTime -> Maybe Text -> WeeklyStartTime)
-> Lens WeeklyStartTime WeeklyStartTime (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WeeklyStartTime' {Maybe Text
timeZone :: Maybe Text
$sel:timeZone:WeeklyStartTime' :: WeeklyStartTime -> Maybe Text
timeZone} -> Maybe Text
timeZone) (\s :: WeeklyStartTime
s@WeeklyStartTime' {} Maybe Text
a -> WeeklyStartTime
s {$sel:timeZone:WeeklyStartTime' :: Maybe Text
timeZone = Maybe Text
a} :: WeeklyStartTime)
weeklyStartTime_timeOfDay :: Lens.Lens' WeeklyStartTime Prelude.Text
weeklyStartTime_timeOfDay :: (Text -> f Text) -> WeeklyStartTime -> f WeeklyStartTime
weeklyStartTime_timeOfDay = (WeeklyStartTime -> Text)
-> (WeeklyStartTime -> Text -> WeeklyStartTime)
-> Lens WeeklyStartTime WeeklyStartTime Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WeeklyStartTime' {Text
timeOfDay :: Text
$sel:timeOfDay:WeeklyStartTime' :: WeeklyStartTime -> Text
timeOfDay} -> Text
timeOfDay) (\s :: WeeklyStartTime
s@WeeklyStartTime' {} Text
a -> WeeklyStartTime
s {$sel:timeOfDay:WeeklyStartTime' :: Text
timeOfDay = Text
a} :: WeeklyStartTime)
weeklyStartTime_dayOfWeek :: Lens.Lens' WeeklyStartTime DayOfWeek
weeklyStartTime_dayOfWeek :: (DayOfWeek -> f DayOfWeek) -> WeeklyStartTime -> f WeeklyStartTime
weeklyStartTime_dayOfWeek = (WeeklyStartTime -> DayOfWeek)
-> (WeeklyStartTime -> DayOfWeek -> WeeklyStartTime)
-> Lens WeeklyStartTime WeeklyStartTime DayOfWeek DayOfWeek
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WeeklyStartTime' {DayOfWeek
dayOfWeek :: DayOfWeek
$sel:dayOfWeek:WeeklyStartTime' :: WeeklyStartTime -> DayOfWeek
dayOfWeek} -> DayOfWeek
dayOfWeek) (\s :: WeeklyStartTime
s@WeeklyStartTime' {} DayOfWeek
a -> WeeklyStartTime
s {$sel:dayOfWeek:WeeklyStartTime' :: DayOfWeek
dayOfWeek = DayOfWeek
a} :: WeeklyStartTime)
instance Core.FromJSON WeeklyStartTime where
parseJSON :: Value -> Parser WeeklyStartTime
parseJSON =
String
-> (Object -> Parser WeeklyStartTime)
-> Value
-> Parser WeeklyStartTime
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"WeeklyStartTime"
( \Object
x ->
Maybe Text -> Text -> DayOfWeek -> WeeklyStartTime
WeeklyStartTime'
(Maybe Text -> Text -> DayOfWeek -> WeeklyStartTime)
-> Parser (Maybe Text)
-> Parser (Text -> DayOfWeek -> WeeklyStartTime)
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
"timeZone")
Parser (Text -> DayOfWeek -> WeeklyStartTime)
-> Parser Text -> Parser (DayOfWeek -> WeeklyStartTime)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timeOfDay")
Parser (DayOfWeek -> WeeklyStartTime)
-> Parser DayOfWeek -> Parser WeeklyStartTime
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DayOfWeek
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dayOfWeek")
)
instance Prelude.Hashable WeeklyStartTime
instance Prelude.NFData WeeklyStartTime
instance Core.ToJSON WeeklyStartTime where
toJSON :: WeeklyStartTime -> Value
toJSON WeeklyStartTime' {Maybe Text
Text
DayOfWeek
dayOfWeek :: DayOfWeek
timeOfDay :: Text
timeZone :: Maybe Text
$sel:dayOfWeek:WeeklyStartTime' :: WeeklyStartTime -> DayOfWeek
$sel:timeOfDay:WeeklyStartTime' :: WeeklyStartTime -> Text
$sel:timeZone:WeeklyStartTime' :: WeeklyStartTime -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"timeZone" 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
timeZone,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"timeOfDay" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
timeOfDay),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dayOfWeek" Text -> DayOfWeek -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DayOfWeek
dayOfWeek)
]
)