{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:endPercentage:RelativeTimeRange' :: Maybe Natural
endPercentage = forall a. Maybe a
Prelude.Nothing,
$sel:first:RelativeTimeRange' :: Maybe Natural
first = forall a. Maybe a
Prelude.Nothing,
$sel:last:RelativeTimeRange' :: Maybe Natural
last = forall a. Maybe a
Prelude.Nothing,
$sel:startPercentage:RelativeTimeRange' :: Maybe Natural
startPercentage = forall a. Maybe a
Prelude.Nothing
}
relativeTimeRange_endPercentage :: Lens.Lens' RelativeTimeRange (Prelude.Maybe Prelude.Natural)
relativeTimeRange_endPercentage :: Lens' RelativeTimeRange (Maybe Natural)
relativeTimeRange_endPercentage = 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 :: Lens' RelativeTimeRange (Maybe Natural)
relativeTimeRange_first = 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 :: Lens' RelativeTimeRange (Maybe Natural)
relativeTimeRange_last = 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 :: Lens' RelativeTimeRange (Maybe Natural)
relativeTimeRange_startPercentage = 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 Data.FromJSON RelativeTimeRange where
parseJSON :: Value -> Parser RelativeTimeRange
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RelativeTimeRange"
( \Object
x ->
Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> RelativeTimeRange
RelativeTimeRange'
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
"EndPercentage")
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
"First")
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
"Last")
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
"StartPercentage")
)
instance Prelude.Hashable RelativeTimeRange where
hashWithSalt :: Int -> RelativeTimeRange -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
endPercentage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
first
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
last
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
startPercentage
instance Prelude.NFData RelativeTimeRange where
rnf :: RelativeTimeRange -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
endPercentage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
first
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
last
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
startPercentage
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EndPercentage" 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 Natural
endPercentage,
(Key
"First" 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 Natural
first,
(Key
"Last" 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 Natural
last,
(Key
"StartPercentage" 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 Natural
startPercentage
]
)