{-# 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.IoTSiteWise.Types.AggregatedValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.Aggregates
import Amazonka.IoTSiteWise.Types.Quality
import qualified Amazonka.Prelude as Prelude
data AggregatedValue = AggregatedValue'
{
AggregatedValue -> Maybe Quality
quality :: Prelude.Maybe Quality,
AggregatedValue -> POSIX
timestamp :: Data.POSIX,
AggregatedValue -> Aggregates
value :: Aggregates
}
deriving (AggregatedValue -> AggregatedValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedValue -> AggregatedValue -> Bool
$c/= :: AggregatedValue -> AggregatedValue -> Bool
== :: AggregatedValue -> AggregatedValue -> Bool
$c== :: AggregatedValue -> AggregatedValue -> Bool
Prelude.Eq, ReadPrec [AggregatedValue]
ReadPrec AggregatedValue
Int -> ReadS AggregatedValue
ReadS [AggregatedValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedValue]
$creadListPrec :: ReadPrec [AggregatedValue]
readPrec :: ReadPrec AggregatedValue
$creadPrec :: ReadPrec AggregatedValue
readList :: ReadS [AggregatedValue]
$creadList :: ReadS [AggregatedValue]
readsPrec :: Int -> ReadS AggregatedValue
$creadsPrec :: Int -> ReadS AggregatedValue
Prelude.Read, Int -> AggregatedValue -> ShowS
[AggregatedValue] -> ShowS
AggregatedValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedValue] -> ShowS
$cshowList :: [AggregatedValue] -> ShowS
show :: AggregatedValue -> String
$cshow :: AggregatedValue -> String
showsPrec :: Int -> AggregatedValue -> ShowS
$cshowsPrec :: Int -> AggregatedValue -> ShowS
Prelude.Show, forall x. Rep AggregatedValue x -> AggregatedValue
forall x. AggregatedValue -> Rep AggregatedValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregatedValue x -> AggregatedValue
$cfrom :: forall x. AggregatedValue -> Rep AggregatedValue x
Prelude.Generic)
newAggregatedValue ::
Prelude.UTCTime ->
Aggregates ->
AggregatedValue
newAggregatedValue :: UTCTime -> Aggregates -> AggregatedValue
newAggregatedValue UTCTime
pTimestamp_ Aggregates
pValue_ =
AggregatedValue'
{ $sel:quality:AggregatedValue' :: Maybe Quality
quality = forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:AggregatedValue' :: POSIX
timestamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_,
$sel:value:AggregatedValue' :: Aggregates
value = Aggregates
pValue_
}
aggregatedValue_quality :: Lens.Lens' AggregatedValue (Prelude.Maybe Quality)
aggregatedValue_quality :: Lens' AggregatedValue (Maybe Quality)
aggregatedValue_quality = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {Maybe Quality
quality :: Maybe Quality
$sel:quality:AggregatedValue' :: AggregatedValue -> Maybe Quality
quality} -> Maybe Quality
quality) (\s :: AggregatedValue
s@AggregatedValue' {} Maybe Quality
a -> AggregatedValue
s {$sel:quality:AggregatedValue' :: Maybe Quality
quality = Maybe Quality
a} :: AggregatedValue)
aggregatedValue_timestamp :: Lens.Lens' AggregatedValue Prelude.UTCTime
aggregatedValue_timestamp :: Lens' AggregatedValue UTCTime
aggregatedValue_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {POSIX
timestamp :: POSIX
$sel:timestamp:AggregatedValue' :: AggregatedValue -> POSIX
timestamp} -> POSIX
timestamp) (\s :: AggregatedValue
s@AggregatedValue' {} POSIX
a -> AggregatedValue
s {$sel:timestamp:AggregatedValue' :: POSIX
timestamp = POSIX
a} :: AggregatedValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
aggregatedValue_value :: Lens.Lens' AggregatedValue Aggregates
aggregatedValue_value :: Lens' AggregatedValue Aggregates
aggregatedValue_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {Aggregates
value :: Aggregates
$sel:value:AggregatedValue' :: AggregatedValue -> Aggregates
value} -> Aggregates
value) (\s :: AggregatedValue
s@AggregatedValue' {} Aggregates
a -> AggregatedValue
s {$sel:value:AggregatedValue' :: Aggregates
value = Aggregates
a} :: AggregatedValue)
instance Data.FromJSON AggregatedValue where
parseJSON :: Value -> Parser AggregatedValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AggregatedValue"
( \Object
x ->
Maybe Quality -> POSIX -> Aggregates -> AggregatedValue
AggregatedValue'
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
"quality")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timestamp")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"value")
)
instance Prelude.Hashable AggregatedValue where
hashWithSalt :: Int -> AggregatedValue -> Int
hashWithSalt Int
_salt AggregatedValue' {Maybe Quality
POSIX
Aggregates
value :: Aggregates
timestamp :: POSIX
quality :: Maybe Quality
$sel:value:AggregatedValue' :: AggregatedValue -> Aggregates
$sel:timestamp:AggregatedValue' :: AggregatedValue -> POSIX
$sel:quality:AggregatedValue' :: AggregatedValue -> Maybe Quality
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Quality
quality
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
timestamp
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Aggregates
value
instance Prelude.NFData AggregatedValue where
rnf :: AggregatedValue -> ()
rnf AggregatedValue' {Maybe Quality
POSIX
Aggregates
value :: Aggregates
timestamp :: POSIX
quality :: Maybe Quality
$sel:value:AggregatedValue' :: AggregatedValue -> Aggregates
$sel:timestamp:AggregatedValue' :: AggregatedValue -> POSIX
$sel:quality:AggregatedValue' :: AggregatedValue -> Maybe Quality
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Quality
quality
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
timestamp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Aggregates
value