{-# 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.AWSHealth.Types.DateTimeRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DateTimeRange = DateTimeRange'
{
DateTimeRange -> Maybe POSIX
to :: Prelude.Maybe Core.POSIX,
DateTimeRange -> Maybe POSIX
from :: Prelude.Maybe Core.POSIX
}
deriving (DateTimeRange -> DateTimeRange -> Bool
(DateTimeRange -> DateTimeRange -> Bool)
-> (DateTimeRange -> DateTimeRange -> Bool) -> Eq DateTimeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DateTimeRange -> DateTimeRange -> Bool
$c/= :: DateTimeRange -> DateTimeRange -> Bool
== :: DateTimeRange -> DateTimeRange -> Bool
$c== :: DateTimeRange -> DateTimeRange -> Bool
Prelude.Eq, ReadPrec [DateTimeRange]
ReadPrec DateTimeRange
Int -> ReadS DateTimeRange
ReadS [DateTimeRange]
(Int -> ReadS DateTimeRange)
-> ReadS [DateTimeRange]
-> ReadPrec DateTimeRange
-> ReadPrec [DateTimeRange]
-> Read DateTimeRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DateTimeRange]
$creadListPrec :: ReadPrec [DateTimeRange]
readPrec :: ReadPrec DateTimeRange
$creadPrec :: ReadPrec DateTimeRange
readList :: ReadS [DateTimeRange]
$creadList :: ReadS [DateTimeRange]
readsPrec :: Int -> ReadS DateTimeRange
$creadsPrec :: Int -> ReadS DateTimeRange
Prelude.Read, Int -> DateTimeRange -> ShowS
[DateTimeRange] -> ShowS
DateTimeRange -> String
(Int -> DateTimeRange -> ShowS)
-> (DateTimeRange -> String)
-> ([DateTimeRange] -> ShowS)
-> Show DateTimeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DateTimeRange] -> ShowS
$cshowList :: [DateTimeRange] -> ShowS
show :: DateTimeRange -> String
$cshow :: DateTimeRange -> String
showsPrec :: Int -> DateTimeRange -> ShowS
$cshowsPrec :: Int -> DateTimeRange -> ShowS
Prelude.Show, (forall x. DateTimeRange -> Rep DateTimeRange x)
-> (forall x. Rep DateTimeRange x -> DateTimeRange)
-> Generic DateTimeRange
forall x. Rep DateTimeRange x -> DateTimeRange
forall x. DateTimeRange -> Rep DateTimeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DateTimeRange x -> DateTimeRange
$cfrom :: forall x. DateTimeRange -> Rep DateTimeRange x
Prelude.Generic)
newDateTimeRange ::
DateTimeRange
newDateTimeRange :: DateTimeRange
newDateTimeRange =
DateTimeRange' :: Maybe POSIX -> Maybe POSIX -> DateTimeRange
DateTimeRange'
{ $sel:to:DateTimeRange' :: Maybe POSIX
to = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:from:DateTimeRange' :: Maybe POSIX
from = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
dateTimeRange_to :: Lens.Lens' DateTimeRange (Prelude.Maybe Prelude.UTCTime)
dateTimeRange_to :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DateTimeRange -> f DateTimeRange
dateTimeRange_to = (DateTimeRange -> Maybe POSIX)
-> (DateTimeRange -> Maybe POSIX -> DateTimeRange)
-> Lens DateTimeRange DateTimeRange (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateTimeRange' {Maybe POSIX
to :: Maybe POSIX
$sel:to:DateTimeRange' :: DateTimeRange -> Maybe POSIX
to} -> Maybe POSIX
to) (\s :: DateTimeRange
s@DateTimeRange' {} Maybe POSIX
a -> DateTimeRange
s {$sel:to:DateTimeRange' :: Maybe POSIX
to = Maybe POSIX
a} :: DateTimeRange) ((Maybe POSIX -> f (Maybe POSIX))
-> DateTimeRange -> f DateTimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DateTimeRange
-> f DateTimeRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
dateTimeRange_from :: Lens.Lens' DateTimeRange (Prelude.Maybe Prelude.UTCTime)
dateTimeRange_from :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DateTimeRange -> f DateTimeRange
dateTimeRange_from = (DateTimeRange -> Maybe POSIX)
-> (DateTimeRange -> Maybe POSIX -> DateTimeRange)
-> Lens DateTimeRange DateTimeRange (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateTimeRange' {Maybe POSIX
from :: Maybe POSIX
$sel:from:DateTimeRange' :: DateTimeRange -> Maybe POSIX
from} -> Maybe POSIX
from) (\s :: DateTimeRange
s@DateTimeRange' {} Maybe POSIX
a -> DateTimeRange
s {$sel:from:DateTimeRange' :: Maybe POSIX
from = Maybe POSIX
a} :: DateTimeRange) ((Maybe POSIX -> f (Maybe POSIX))
-> DateTimeRange -> f DateTimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DateTimeRange
-> f DateTimeRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.Hashable DateTimeRange
instance Prelude.NFData DateTimeRange
instance Core.ToJSON DateTimeRange where
toJSON :: DateTimeRange -> Value
toJSON DateTimeRange' {Maybe POSIX
from :: Maybe POSIX
to :: Maybe POSIX
$sel:from:DateTimeRange' :: DateTimeRange -> Maybe POSIX
$sel:to:DateTimeRange' :: DateTimeRange -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"to" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
to,
(Text
"from" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
from
]
)