{-# 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.Schedule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.CampaignEventFilter
import Amazonka.Pinpoint.Types.Frequency
import Amazonka.Pinpoint.Types.QuietTime
import qualified Amazonka.Prelude as Prelude
data Schedule = Schedule'
{
Schedule -> Maybe Frequency
frequency :: Prelude.Maybe Frequency,
Schedule -> Maybe QuietTime
quietTime :: Prelude.Maybe QuietTime,
Schedule -> Maybe CampaignEventFilter
eventFilter :: Prelude.Maybe CampaignEventFilter,
Schedule -> Maybe Bool
isLocalTime :: Prelude.Maybe Prelude.Bool,
Schedule -> Maybe Text
endTime :: Prelude.Maybe Prelude.Text,
Schedule -> Maybe Text
timezone :: Prelude.Maybe Prelude.Text,
Schedule -> Text
startTime :: Prelude.Text
}
deriving (Schedule -> Schedule -> Bool
(Schedule -> Schedule -> Bool)
-> (Schedule -> Schedule -> Bool) -> Eq Schedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Schedule -> Schedule -> Bool
$c/= :: Schedule -> Schedule -> Bool
== :: Schedule -> Schedule -> Bool
$c== :: Schedule -> Schedule -> Bool
Prelude.Eq, ReadPrec [Schedule]
ReadPrec Schedule
Int -> ReadS Schedule
ReadS [Schedule]
(Int -> ReadS Schedule)
-> ReadS [Schedule]
-> ReadPrec Schedule
-> ReadPrec [Schedule]
-> Read Schedule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Schedule]
$creadListPrec :: ReadPrec [Schedule]
readPrec :: ReadPrec Schedule
$creadPrec :: ReadPrec Schedule
readList :: ReadS [Schedule]
$creadList :: ReadS [Schedule]
readsPrec :: Int -> ReadS Schedule
$creadsPrec :: Int -> ReadS Schedule
Prelude.Read, Int -> Schedule -> ShowS
[Schedule] -> ShowS
Schedule -> String
(Int -> Schedule -> ShowS)
-> (Schedule -> String) -> ([Schedule] -> ShowS) -> Show Schedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Schedule] -> ShowS
$cshowList :: [Schedule] -> ShowS
show :: Schedule -> String
$cshow :: Schedule -> String
showsPrec :: Int -> Schedule -> ShowS
$cshowsPrec :: Int -> Schedule -> ShowS
Prelude.Show, (forall x. Schedule -> Rep Schedule x)
-> (forall x. Rep Schedule x -> Schedule) -> Generic Schedule
forall x. Rep Schedule x -> Schedule
forall x. Schedule -> Rep Schedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Schedule x -> Schedule
$cfrom :: forall x. Schedule -> Rep Schedule x
Prelude.Generic)
newSchedule ::
Prelude.Text ->
Schedule
newSchedule :: Text -> Schedule
newSchedule Text
pStartTime_ =
Schedule' :: Maybe Frequency
-> Maybe QuietTime
-> Maybe CampaignEventFilter
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Schedule
Schedule'
{ $sel:frequency:Schedule' :: Maybe Frequency
frequency = Maybe Frequency
forall a. Maybe a
Prelude.Nothing,
$sel:quietTime:Schedule' :: Maybe QuietTime
quietTime = Maybe QuietTime
forall a. Maybe a
Prelude.Nothing,
$sel:eventFilter:Schedule' :: Maybe CampaignEventFilter
eventFilter = Maybe CampaignEventFilter
forall a. Maybe a
Prelude.Nothing,
$sel:isLocalTime:Schedule' :: Maybe Bool
isLocalTime = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:Schedule' :: Maybe Text
endTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timezone:Schedule' :: Maybe Text
timezone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:startTime:Schedule' :: Text
startTime = Text
pStartTime_
}
schedule_frequency :: Lens.Lens' Schedule (Prelude.Maybe Frequency)
schedule_frequency :: (Maybe Frequency -> f (Maybe Frequency)) -> Schedule -> f Schedule
schedule_frequency = (Schedule -> Maybe Frequency)
-> (Schedule -> Maybe Frequency -> Schedule)
-> Lens Schedule Schedule (Maybe Frequency) (Maybe Frequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Frequency
frequency :: Maybe Frequency
$sel:frequency:Schedule' :: Schedule -> Maybe Frequency
frequency} -> Maybe Frequency
frequency) (\s :: Schedule
s@Schedule' {} Maybe Frequency
a -> Schedule
s {$sel:frequency:Schedule' :: Maybe Frequency
frequency = Maybe Frequency
a} :: Schedule)
schedule_quietTime :: Lens.Lens' Schedule (Prelude.Maybe QuietTime)
schedule_quietTime :: (Maybe QuietTime -> f (Maybe QuietTime)) -> Schedule -> f Schedule
schedule_quietTime = (Schedule -> Maybe QuietTime)
-> (Schedule -> Maybe QuietTime -> Schedule)
-> Lens Schedule Schedule (Maybe QuietTime) (Maybe QuietTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe QuietTime
quietTime :: Maybe QuietTime
$sel:quietTime:Schedule' :: Schedule -> Maybe QuietTime
quietTime} -> Maybe QuietTime
quietTime) (\s :: Schedule
s@Schedule' {} Maybe QuietTime
a -> Schedule
s {$sel:quietTime:Schedule' :: Maybe QuietTime
quietTime = Maybe QuietTime
a} :: Schedule)
schedule_eventFilter :: Lens.Lens' Schedule (Prelude.Maybe CampaignEventFilter)
schedule_eventFilter :: (Maybe CampaignEventFilter -> f (Maybe CampaignEventFilter))
-> Schedule -> f Schedule
schedule_eventFilter = (Schedule -> Maybe CampaignEventFilter)
-> (Schedule -> Maybe CampaignEventFilter -> Schedule)
-> Lens
Schedule
Schedule
(Maybe CampaignEventFilter)
(Maybe CampaignEventFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe CampaignEventFilter
eventFilter :: Maybe CampaignEventFilter
$sel:eventFilter:Schedule' :: Schedule -> Maybe CampaignEventFilter
eventFilter} -> Maybe CampaignEventFilter
eventFilter) (\s :: Schedule
s@Schedule' {} Maybe CampaignEventFilter
a -> Schedule
s {$sel:eventFilter:Schedule' :: Maybe CampaignEventFilter
eventFilter = Maybe CampaignEventFilter
a} :: Schedule)
schedule_isLocalTime :: Lens.Lens' Schedule (Prelude.Maybe Prelude.Bool)
schedule_isLocalTime :: (Maybe Bool -> f (Maybe Bool)) -> Schedule -> f Schedule
schedule_isLocalTime = (Schedule -> Maybe Bool)
-> (Schedule -> Maybe Bool -> Schedule)
-> Lens Schedule Schedule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Bool
isLocalTime :: Maybe Bool
$sel:isLocalTime:Schedule' :: Schedule -> Maybe Bool
isLocalTime} -> Maybe Bool
isLocalTime) (\s :: Schedule
s@Schedule' {} Maybe Bool
a -> Schedule
s {$sel:isLocalTime:Schedule' :: Maybe Bool
isLocalTime = Maybe Bool
a} :: Schedule)
schedule_endTime :: Lens.Lens' Schedule (Prelude.Maybe Prelude.Text)
schedule_endTime :: (Maybe Text -> f (Maybe Text)) -> Schedule -> f Schedule
schedule_endTime = (Schedule -> Maybe Text)
-> (Schedule -> Maybe Text -> Schedule)
-> Lens Schedule Schedule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Text
endTime :: Maybe Text
$sel:endTime:Schedule' :: Schedule -> Maybe Text
endTime} -> Maybe Text
endTime) (\s :: Schedule
s@Schedule' {} Maybe Text
a -> Schedule
s {$sel:endTime:Schedule' :: Maybe Text
endTime = Maybe Text
a} :: Schedule)
schedule_timezone :: Lens.Lens' Schedule (Prelude.Maybe Prelude.Text)
schedule_timezone :: (Maybe Text -> f (Maybe Text)) -> Schedule -> f Schedule
schedule_timezone = (Schedule -> Maybe Text)
-> (Schedule -> Maybe Text -> Schedule)
-> Lens Schedule Schedule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Text
timezone :: Maybe Text
$sel:timezone:Schedule' :: Schedule -> Maybe Text
timezone} -> Maybe Text
timezone) (\s :: Schedule
s@Schedule' {} Maybe Text
a -> Schedule
s {$sel:timezone:Schedule' :: Maybe Text
timezone = Maybe Text
a} :: Schedule)
schedule_startTime :: Lens.Lens' Schedule Prelude.Text
schedule_startTime :: (Text -> f Text) -> Schedule -> f Schedule
schedule_startTime = (Schedule -> Text)
-> (Schedule -> Text -> Schedule)
-> Lens Schedule Schedule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Text
startTime :: Text
$sel:startTime:Schedule' :: Schedule -> Text
startTime} -> Text
startTime) (\s :: Schedule
s@Schedule' {} Text
a -> Schedule
s {$sel:startTime:Schedule' :: Text
startTime = Text
a} :: Schedule)
instance Core.FromJSON Schedule where
parseJSON :: Value -> Parser Schedule
parseJSON =
String -> (Object -> Parser Schedule) -> Value -> Parser Schedule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Schedule"
( \Object
x ->
Maybe Frequency
-> Maybe QuietTime
-> Maybe CampaignEventFilter
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Schedule
Schedule'
(Maybe Frequency
-> Maybe QuietTime
-> Maybe CampaignEventFilter
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Schedule)
-> Parser (Maybe Frequency)
-> Parser
(Maybe QuietTime
-> Maybe CampaignEventFilter
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Schedule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Frequency)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Frequency")
Parser
(Maybe QuietTime
-> Maybe CampaignEventFilter
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Schedule)
-> Parser (Maybe QuietTime)
-> Parser
(Maybe CampaignEventFilter
-> Maybe Bool -> Maybe Text -> Maybe Text -> Text -> Schedule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe QuietTime)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"QuietTime")
Parser
(Maybe CampaignEventFilter
-> Maybe Bool -> Maybe Text -> Maybe Text -> Text -> Schedule)
-> Parser (Maybe CampaignEventFilter)
-> Parser
(Maybe Bool -> Maybe Text -> Maybe Text -> Text -> Schedule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CampaignEventFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventFilter")
Parser (Maybe Bool -> Maybe Text -> Maybe Text -> Text -> Schedule)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> Text -> Schedule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsLocalTime")
Parser (Maybe Text -> Maybe Text -> Text -> Schedule)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Text -> Schedule)
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
"EndTime")
Parser (Maybe Text -> Text -> Schedule)
-> Parser (Maybe Text) -> Parser (Text -> Schedule)
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
"Timezone")
Parser (Text -> Schedule) -> Parser Text -> Parser Schedule
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
"StartTime")
)
instance Prelude.Hashable Schedule
instance Prelude.NFData Schedule
instance Core.ToJSON Schedule where
toJSON :: Schedule -> Value
toJSON Schedule' {Maybe Bool
Maybe Text
Maybe Frequency
Maybe QuietTime
Maybe CampaignEventFilter
Text
startTime :: Text
timezone :: Maybe Text
endTime :: Maybe Text
isLocalTime :: Maybe Bool
eventFilter :: Maybe CampaignEventFilter
quietTime :: Maybe QuietTime
frequency :: Maybe Frequency
$sel:startTime:Schedule' :: Schedule -> Text
$sel:timezone:Schedule' :: Schedule -> Maybe Text
$sel:endTime:Schedule' :: Schedule -> Maybe Text
$sel:isLocalTime:Schedule' :: Schedule -> Maybe Bool
$sel:eventFilter:Schedule' :: Schedule -> Maybe CampaignEventFilter
$sel:quietTime:Schedule' :: Schedule -> Maybe QuietTime
$sel:frequency:Schedule' :: Schedule -> Maybe Frequency
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Frequency" Text -> Frequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Frequency -> Pair) -> Maybe Frequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Frequency
frequency,
(Text
"QuietTime" Text -> QuietTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (QuietTime -> Pair) -> Maybe QuietTime -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QuietTime
quietTime,
(Text
"EventFilter" Text -> CampaignEventFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CampaignEventFilter -> Pair)
-> Maybe CampaignEventFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CampaignEventFilter
eventFilter,
(Text
"IsLocalTime" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isLocalTime,
(Text
"EndTime" 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
endTime,
(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
"StartTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
startTime)
]
)