{-# 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.RelativeTimeRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RelativeTimeRange = RelativeTimeRange'
{
RelativeTimeRange -> Maybe Natural
endPercentage :: Prelude.Maybe Prelude.Natural,
RelativeTimeRange -> Maybe Natural
first :: Prelude.Maybe Prelude.Natural,
RelativeTimeRange -> Maybe Natural
last :: Prelude.Maybe Prelude.Natural,
RelativeTimeRange -> Maybe Natural
startPercentage :: Prelude.Maybe Prelude.Natural
}
deriving (RelativeTimeRange -> RelativeTimeRange -> Bool
(RelativeTimeRange -> RelativeTimeRange -> Bool)
-> (RelativeTimeRange -> RelativeTimeRange -> Bool)
-> Eq RelativeTimeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelativeTimeRange -> RelativeTimeRange -> Bool
$c/= :: RelativeTimeRange -> RelativeTimeRange -> Bool
== :: RelativeTimeRange -> RelativeTimeRange -> Bool
$c== :: RelativeTimeRange -> RelativeTimeRange -> Bool
Prelude.Eq, ReadPrec [RelativeTimeRange]
ReadPrec RelativeTimeRange
Int -> ReadS RelativeTimeRange
ReadS [RelativeTimeRange]
(Int -> ReadS RelativeTimeRange)
-> ReadS [RelativeTimeRange]
-> ReadPrec RelativeTimeRange
-> ReadPrec [RelativeTimeRange]
-> Read RelativeTimeRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelativeTimeRange]
$creadListPrec :: ReadPrec [RelativeTimeRange]
readPrec :: ReadPrec RelativeTimeRange
$creadPrec :: ReadPrec RelativeTimeRange
readList :: ReadS [RelativeTimeRange]
$creadList :: ReadS [RelativeTimeRange]
readsPrec :: Int -> ReadS RelativeTimeRange
$creadsPrec :: Int -> ReadS RelativeTimeRange
Prelude.Read, Int -> RelativeTimeRange -> ShowS
[RelativeTimeRange] -> ShowS
RelativeTimeRange -> String
(Int -> RelativeTimeRange -> ShowS)
-> (RelativeTimeRange -> String)
-> ([RelativeTimeRange] -> ShowS)
-> Show RelativeTimeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelativeTimeRange] -> ShowS
$cshowList :: [RelativeTimeRange] -> ShowS
show :: RelativeTimeRange -> String
$cshow :: RelativeTimeRange -> String
showsPrec :: Int -> RelativeTimeRange -> ShowS
$cshowsPrec :: Int -> RelativeTimeRange -> ShowS
Prelude.Show, (forall x. RelativeTimeRange -> Rep RelativeTimeRange x)
-> (forall x. Rep RelativeTimeRange x -> RelativeTimeRange)
-> Generic RelativeTimeRange
forall x. Rep RelativeTimeRange x -> RelativeTimeRange
forall x. RelativeTimeRange -> Rep RelativeTimeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelativeTimeRange x -> RelativeTimeRange
$cfrom :: forall x. RelativeTimeRange -> Rep RelativeTimeRange x
Prelude.Generic)
newRelativeTimeRange ::
RelativeTimeRange
newRelativeTimeRange :: RelativeTimeRange
newRelativeTimeRange =
RelativeTimeRange' :: Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> RelativeTimeRange
RelativeTimeRange'
{ $sel:endPercentage:RelativeTimeRange' :: Maybe Natural
endPercentage = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:first:RelativeTimeRange' :: Maybe Natural
first = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:last:RelativeTimeRange' :: Maybe Natural
last = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:startPercentage:RelativeTimeRange' :: Maybe Natural
startPercentage = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
relativeTimeRange_endPercentage :: Lens.Lens' RelativeTimeRange (Prelude.Maybe Prelude.Natural)
relativeTimeRange_endPercentage :: (Maybe Natural -> f (Maybe Natural))
-> RelativeTimeRange -> f RelativeTimeRange
relativeTimeRange_endPercentage = (RelativeTimeRange -> Maybe Natural)
-> (RelativeTimeRange -> Maybe Natural -> RelativeTimeRange)
-> Lens
RelativeTimeRange RelativeTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelativeTimeRange' {Maybe Natural
endPercentage :: Maybe Natural
$sel:endPercentage:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
endPercentage} -> Maybe Natural
endPercentage) (\s :: RelativeTimeRange
s@RelativeTimeRange' {} Maybe Natural
a -> RelativeTimeRange
s {$sel:endPercentage:RelativeTimeRange' :: Maybe Natural
endPercentage = Maybe Natural
a} :: RelativeTimeRange)
relativeTimeRange_first :: Lens.Lens' RelativeTimeRange (Prelude.Maybe Prelude.Natural)
relativeTimeRange_first :: (Maybe Natural -> f (Maybe Natural))
-> RelativeTimeRange -> f RelativeTimeRange
relativeTimeRange_first = (RelativeTimeRange -> Maybe Natural)
-> (RelativeTimeRange -> Maybe Natural -> RelativeTimeRange)
-> Lens
RelativeTimeRange RelativeTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelativeTimeRange' {Maybe Natural
first :: Maybe Natural
$sel:first:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
first} -> Maybe Natural
first) (\s :: RelativeTimeRange
s@RelativeTimeRange' {} Maybe Natural
a -> RelativeTimeRange
s {$sel:first:RelativeTimeRange' :: Maybe Natural
first = Maybe Natural
a} :: RelativeTimeRange)
relativeTimeRange_last :: Lens.Lens' RelativeTimeRange (Prelude.Maybe Prelude.Natural)
relativeTimeRange_last :: (Maybe Natural -> f (Maybe Natural))
-> RelativeTimeRange -> f RelativeTimeRange
relativeTimeRange_last = (RelativeTimeRange -> Maybe Natural)
-> (RelativeTimeRange -> Maybe Natural -> RelativeTimeRange)
-> Lens
RelativeTimeRange RelativeTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelativeTimeRange' {Maybe Natural
last :: Maybe Natural
$sel:last:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
last} -> Maybe Natural
last) (\s :: RelativeTimeRange
s@RelativeTimeRange' {} Maybe Natural
a -> RelativeTimeRange
s {$sel:last:RelativeTimeRange' :: Maybe Natural
last = Maybe Natural
a} :: RelativeTimeRange)
relativeTimeRange_startPercentage :: Lens.Lens' RelativeTimeRange (Prelude.Maybe Prelude.Natural)
relativeTimeRange_startPercentage :: (Maybe Natural -> f (Maybe Natural))
-> RelativeTimeRange -> f RelativeTimeRange
relativeTimeRange_startPercentage = (RelativeTimeRange -> Maybe Natural)
-> (RelativeTimeRange -> Maybe Natural -> RelativeTimeRange)
-> Lens
RelativeTimeRange RelativeTimeRange (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelativeTimeRange' {Maybe Natural
startPercentage :: Maybe Natural
$sel:startPercentage:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
startPercentage} -> Maybe Natural
startPercentage) (\s :: RelativeTimeRange
s@RelativeTimeRange' {} Maybe Natural
a -> RelativeTimeRange
s {$sel:startPercentage:RelativeTimeRange' :: Maybe Natural
startPercentage = Maybe Natural
a} :: RelativeTimeRange)
instance Core.FromJSON RelativeTimeRange where
parseJSON :: Value -> Parser RelativeTimeRange
parseJSON =
String
-> (Object -> Parser RelativeTimeRange)
-> Value
-> Parser RelativeTimeRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RelativeTimeRange"
( \Object
x ->
Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> RelativeTimeRange
RelativeTimeRange'
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> RelativeTimeRange)
-> Parser (Maybe Natural)
-> Parser
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> RelativeTimeRange)
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
"EndPercentage")
Parser
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> RelativeTimeRange)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> RelativeTimeRange)
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
"First")
Parser (Maybe Natural -> Maybe Natural -> RelativeTimeRange)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> RelativeTimeRange)
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 -> RelativeTimeRange)
-> Parser (Maybe Natural) -> Parser RelativeTimeRange
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
"StartPercentage")
)
instance Prelude.Hashable RelativeTimeRange
instance Prelude.NFData RelativeTimeRange
instance Core.ToJSON RelativeTimeRange where
toJSON :: RelativeTimeRange -> Value
toJSON RelativeTimeRange' {Maybe Natural
startPercentage :: Maybe Natural
last :: Maybe Natural
first :: Maybe Natural
endPercentage :: Maybe Natural
$sel:startPercentage:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
$sel:last:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
$sel:first:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
$sel:endPercentage:RelativeTimeRange' :: RelativeTimeRange -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EndPercentage" 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
endPercentage,
(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
"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
"StartPercentage" 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
startPercentage
]
)