{-# 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.Transcribe.Types.AbsoluteTimeRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AbsoluteTimeRange = AbsoluteTimeRange'
{
AbsoluteTimeRange -> Maybe Natural
first :: Prelude.Maybe Prelude.Natural,
AbsoluteTimeRange -> Maybe Natural
startTime :: Prelude.Maybe Prelude.Natural,
AbsoluteTimeRange -> Maybe Natural
last :: Prelude.Maybe Prelude.Natural,
AbsoluteTimeRange -> Maybe Natural
endTime :: Prelude.Maybe Prelude.Natural
}
deriving (AbsoluteTimeRange -> AbsoluteTimeRange -> Bool
(AbsoluteTimeRange -> AbsoluteTimeRange -> Bool)
-> (AbsoluteTimeRange -> AbsoluteTimeRange -> Bool)
-> Eq AbsoluteTimeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AbsoluteTimeRange -> AbsoluteTimeRange -> Bool
$c/= :: AbsoluteTimeRange -> AbsoluteTimeRange -> Bool
== :: AbsoluteTimeRange -> AbsoluteTimeRange -> Bool
$c== :: AbsoluteTimeRange -> AbsoluteTimeRange -> Bool
Prelude.Eq, ReadPrec [AbsoluteTimeRange]
ReadPrec AbsoluteTimeRange
Int -> ReadS AbsoluteTimeRange
ReadS [AbsoluteTimeRange]
(Int -> ReadS AbsoluteTimeRange)
-> ReadS [AbsoluteTimeRange]
-> ReadPrec AbsoluteTimeRange
-> ReadPrec [AbsoluteTimeRange]
-> Read AbsoluteTimeRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AbsoluteTimeRange]
$creadListPrec :: ReadPrec [AbsoluteTimeRange]
readPrec :: ReadPrec AbsoluteTimeRange
$creadPrec :: ReadPrec AbsoluteTimeRange
readList :: ReadS [AbsoluteTimeRange]
$creadList :: ReadS [AbsoluteTimeRange]
readsPrec :: Int -> ReadS AbsoluteTimeRange
$creadsPrec :: Int -> ReadS AbsoluteTimeRange
Prelude.Read, Int -> AbsoluteTimeRange -> ShowS
[AbsoluteTimeRange] -> ShowS
AbsoluteTimeRange -> String
(Int -> AbsoluteTimeRange -> ShowS)
-> (AbsoluteTimeRange -> String)
-> ([AbsoluteTimeRange] -> ShowS)
-> Show AbsoluteTimeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AbsoluteTimeRange] -> ShowS
$cshowList :: [AbsoluteTimeRange] -> ShowS
show :: AbsoluteTimeRange -> String
$cshow :: AbsoluteTimeRange -> String
showsPrec :: Int -> AbsoluteTimeRange -> ShowS
$cshowsPrec :: Int -> AbsoluteTimeRange -> ShowS
Prelude.Show, (forall x. AbsoluteTimeRange -> Rep AbsoluteTimeRange x)
-> (forall x. Rep AbsoluteTimeRange x -> AbsoluteTimeRange)
-> Generic AbsoluteTimeRange
forall x. Rep AbsoluteTimeRange x -> AbsoluteTimeRange
forall x. AbsoluteTimeRange -> Rep AbsoluteTimeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AbsoluteTimeRange x -> AbsoluteTimeRange
$cfrom :: forall x. AbsoluteTimeRange -> Rep AbsoluteTimeRange x
Prelude.Generic)
newAbsoluteTimeRange ::
AbsoluteTimeRange
newAbsoluteTimeRange :: AbsoluteTimeRange
newAbsoluteTimeRange =
AbsoluteTimeRange' :: Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> AbsoluteTimeRange
AbsoluteTimeRange'
{ $sel:first:AbsoluteTimeRange' :: Maybe Natural
first = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:startTime:AbsoluteTimeRange' :: Maybe Natural
startTime = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:last:AbsoluteTimeRange' :: Maybe Natural
last = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:AbsoluteTimeRange' :: Maybe Natural
endTime = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
absoluteTimeRange_first :: Lens.Lens' AbsoluteTimeRange (Prelude.Maybe Prelude.Natural)
absoluteTimeRange_first :: (Maybe Natural -> f (Maybe Natural))
-> AbsoluteTimeRange -> f AbsoluteTimeRange
absoluteTimeRange_first = (AbsoluteTimeRange -> Maybe Natural)
-> (AbsoluteTimeRange -> Maybe Natural -> AbsoluteTimeRange)
-> Lens
AbsoluteTimeRange AbsoluteTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbsoluteTimeRange' {Maybe Natural
first :: Maybe Natural
$sel:first:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
first} -> Maybe Natural
first) (\s :: AbsoluteTimeRange
s@AbsoluteTimeRange' {} Maybe Natural
a -> AbsoluteTimeRange
s {$sel:first:AbsoluteTimeRange' :: Maybe Natural
first = Maybe Natural
a} :: AbsoluteTimeRange)
absoluteTimeRange_startTime :: Lens.Lens' AbsoluteTimeRange (Prelude.Maybe Prelude.Natural)
absoluteTimeRange_startTime :: (Maybe Natural -> f (Maybe Natural))
-> AbsoluteTimeRange -> f AbsoluteTimeRange
absoluteTimeRange_startTime = (AbsoluteTimeRange -> Maybe Natural)
-> (AbsoluteTimeRange -> Maybe Natural -> AbsoluteTimeRange)
-> Lens
AbsoluteTimeRange AbsoluteTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbsoluteTimeRange' {Maybe Natural
startTime :: Maybe Natural
$sel:startTime:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
startTime} -> Maybe Natural
startTime) (\s :: AbsoluteTimeRange
s@AbsoluteTimeRange' {} Maybe Natural
a -> AbsoluteTimeRange
s {$sel:startTime:AbsoluteTimeRange' :: Maybe Natural
startTime = Maybe Natural
a} :: AbsoluteTimeRange)
absoluteTimeRange_last :: Lens.Lens' AbsoluteTimeRange (Prelude.Maybe Prelude.Natural)
absoluteTimeRange_last :: (Maybe Natural -> f (Maybe Natural))
-> AbsoluteTimeRange -> f AbsoluteTimeRange
absoluteTimeRange_last = (AbsoluteTimeRange -> Maybe Natural)
-> (AbsoluteTimeRange -> Maybe Natural -> AbsoluteTimeRange)
-> Lens
AbsoluteTimeRange AbsoluteTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbsoluteTimeRange' {Maybe Natural
last :: Maybe Natural
$sel:last:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
last} -> Maybe Natural
last) (\s :: AbsoluteTimeRange
s@AbsoluteTimeRange' {} Maybe Natural
a -> AbsoluteTimeRange
s {$sel:last:AbsoluteTimeRange' :: Maybe Natural
last = Maybe Natural
a} :: AbsoluteTimeRange)
absoluteTimeRange_endTime :: Lens.Lens' AbsoluteTimeRange (Prelude.Maybe Prelude.Natural)
absoluteTimeRange_endTime :: (Maybe Natural -> f (Maybe Natural))
-> AbsoluteTimeRange -> f AbsoluteTimeRange
absoluteTimeRange_endTime = (AbsoluteTimeRange -> Maybe Natural)
-> (AbsoluteTimeRange -> Maybe Natural -> AbsoluteTimeRange)
-> Lens
AbsoluteTimeRange AbsoluteTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbsoluteTimeRange' {Maybe Natural
endTime :: Maybe Natural
$sel:endTime:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
endTime} -> Maybe Natural
endTime) (\s :: AbsoluteTimeRange
s@AbsoluteTimeRange' {} Maybe Natural
a -> AbsoluteTimeRange
s {$sel:endTime:AbsoluteTimeRange' :: Maybe Natural
endTime = Maybe Natural
a} :: AbsoluteTimeRange)
instance Core.FromJSON AbsoluteTimeRange where
parseJSON :: Value -> Parser AbsoluteTimeRange
parseJSON =
String
-> (Object -> Parser AbsoluteTimeRange)
-> Value
-> Parser AbsoluteTimeRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AbsoluteTimeRange"
( \Object
x ->
Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> AbsoluteTimeRange
AbsoluteTimeRange'
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> AbsoluteTimeRange)
-> Parser (Maybe Natural)
-> Parser
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> AbsoluteTimeRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"First")
Parser
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> AbsoluteTimeRange)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> AbsoluteTimeRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
Parser (Maybe Natural -> Maybe Natural -> AbsoluteTimeRange)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> AbsoluteTimeRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Last")
Parser (Maybe Natural -> AbsoluteTimeRange)
-> Parser (Maybe Natural) -> Parser AbsoluteTimeRange
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTime")
)
instance Prelude.Hashable AbsoluteTimeRange
instance Prelude.NFData AbsoluteTimeRange
instance Core.ToJSON AbsoluteTimeRange where
toJSON :: AbsoluteTimeRange -> Value
toJSON AbsoluteTimeRange' {Maybe Natural
endTime :: Maybe Natural
last :: Maybe Natural
startTime :: Maybe Natural
first :: Maybe Natural
$sel:endTime:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
$sel:last:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
$sel:startTime:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
$sel:first:AbsoluteTimeRange' :: AbsoluteTimeRange -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"First" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
first,
(Text
"StartTime" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
startTime,
(Text
"Last" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
last,
(Text
"EndTime" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
endTime
]
)