{-# 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.JourneySchedule 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 JourneySchedule = JourneySchedule'
{
JourneySchedule -> Maybe ISO8601
endTime :: Prelude.Maybe Data.ISO8601,
JourneySchedule -> Maybe ISO8601
startTime :: Prelude.Maybe Data.ISO8601,
JourneySchedule -> Maybe Text
timezone :: Prelude.Maybe Prelude.Text
}
deriving (JourneySchedule -> JourneySchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneySchedule -> JourneySchedule -> Bool
$c/= :: JourneySchedule -> JourneySchedule -> Bool
== :: JourneySchedule -> JourneySchedule -> Bool
$c== :: JourneySchedule -> JourneySchedule -> Bool
Prelude.Eq, ReadPrec [JourneySchedule]
ReadPrec JourneySchedule
Int -> ReadS JourneySchedule
ReadS [JourneySchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneySchedule]
$creadListPrec :: ReadPrec [JourneySchedule]
readPrec :: ReadPrec JourneySchedule
$creadPrec :: ReadPrec JourneySchedule
readList :: ReadS [JourneySchedule]
$creadList :: ReadS [JourneySchedule]
readsPrec :: Int -> ReadS JourneySchedule
$creadsPrec :: Int -> ReadS JourneySchedule
Prelude.Read, Int -> JourneySchedule -> ShowS
[JourneySchedule] -> ShowS
JourneySchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneySchedule] -> ShowS
$cshowList :: [JourneySchedule] -> ShowS
show :: JourneySchedule -> String
$cshow :: JourneySchedule -> String
showsPrec :: Int -> JourneySchedule -> ShowS
$cshowsPrec :: Int -> JourneySchedule -> ShowS
Prelude.Show, forall x. Rep JourneySchedule x -> JourneySchedule
forall x. JourneySchedule -> Rep JourneySchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JourneySchedule x -> JourneySchedule
$cfrom :: forall x. JourneySchedule -> Rep JourneySchedule x
Prelude.Generic)
newJourneySchedule ::
JourneySchedule
newJourneySchedule :: JourneySchedule
newJourneySchedule =
JourneySchedule'
{ $sel:endTime:JourneySchedule' :: Maybe ISO8601
endTime = forall a. Maybe a
Prelude.Nothing,
$sel:startTime:JourneySchedule' :: Maybe ISO8601
startTime = forall a. Maybe a
Prelude.Nothing,
$sel:timezone:JourneySchedule' :: Maybe Text
timezone = forall a. Maybe a
Prelude.Nothing
}
journeySchedule_endTime :: Lens.Lens' JourneySchedule (Prelude.Maybe Prelude.UTCTime)
journeySchedule_endTime :: Lens' JourneySchedule (Maybe UTCTime)
journeySchedule_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySchedule' {Maybe ISO8601
endTime :: Maybe ISO8601
$sel:endTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
endTime} -> Maybe ISO8601
endTime) (\s :: JourneySchedule
s@JourneySchedule' {} Maybe ISO8601
a -> JourneySchedule
s {$sel:endTime:JourneySchedule' :: Maybe ISO8601
endTime = Maybe ISO8601
a} :: JourneySchedule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
journeySchedule_startTime :: Lens.Lens' JourneySchedule (Prelude.Maybe Prelude.UTCTime)
journeySchedule_startTime :: Lens' JourneySchedule (Maybe UTCTime)
journeySchedule_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySchedule' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: JourneySchedule
s@JourneySchedule' {} Maybe ISO8601
a -> JourneySchedule
s {$sel:startTime:JourneySchedule' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: JourneySchedule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
journeySchedule_timezone :: Lens.Lens' JourneySchedule (Prelude.Maybe Prelude.Text)
journeySchedule_timezone :: Lens' JourneySchedule (Maybe Text)
journeySchedule_timezone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySchedule' {Maybe Text
timezone :: Maybe Text
$sel:timezone:JourneySchedule' :: JourneySchedule -> Maybe Text
timezone} -> Maybe Text
timezone) (\s :: JourneySchedule
s@JourneySchedule' {} Maybe Text
a -> JourneySchedule
s {$sel:timezone:JourneySchedule' :: Maybe Text
timezone = Maybe Text
a} :: JourneySchedule)
instance Data.FromJSON JourneySchedule where
parseJSON :: Value -> Parser JourneySchedule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"JourneySchedule"
( \Object
x ->
Maybe ISO8601 -> Maybe ISO8601 -> Maybe Text -> JourneySchedule
JourneySchedule'
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
"EndTime")
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
"StartTime")
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
"Timezone")
)
instance Prelude.Hashable JourneySchedule where
hashWithSalt :: Int -> JourneySchedule -> Int
hashWithSalt Int
_salt JourneySchedule' {Maybe Text
Maybe ISO8601
timezone :: Maybe Text
startTime :: Maybe ISO8601
endTime :: Maybe ISO8601
$sel:timezone:JourneySchedule' :: JourneySchedule -> Maybe Text
$sel:startTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
$sel:endTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
endTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
startTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timezone
instance Prelude.NFData JourneySchedule where
rnf :: JourneySchedule -> ()
rnf JourneySchedule' {Maybe Text
Maybe ISO8601
timezone :: Maybe Text
startTime :: Maybe ISO8601
endTime :: Maybe ISO8601
$sel:timezone:JourneySchedule' :: JourneySchedule -> Maybe Text
$sel:startTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
$sel:endTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
endTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
startTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timezone
instance Data.ToJSON JourneySchedule where
toJSON :: JourneySchedule -> Value
toJSON JourneySchedule' {Maybe Text
Maybe ISO8601
timezone :: Maybe Text
startTime :: Maybe ISO8601
endTime :: Maybe ISO8601
$sel:timezone:JourneySchedule' :: JourneySchedule -> Maybe Text
$sel:startTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
$sel:endTime:JourneySchedule' :: JourneySchedule -> Maybe ISO8601
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EndTime" 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 ISO8601
endTime,
(Key
"StartTime" 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 ISO8601
startTime,
(Key
"Timezone" 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 Text
timezone
]
)