{-# 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.ForecastQuery.Types.DataPoint where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DataPoint = DataPoint'
{
DataPoint -> Maybe Double
value :: Prelude.Maybe Prelude.Double,
DataPoint -> Maybe Text
timestamp :: Prelude.Maybe Prelude.Text
}
deriving (DataPoint -> DataPoint -> Bool
(DataPoint -> DataPoint -> Bool)
-> (DataPoint -> DataPoint -> Bool) -> Eq DataPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataPoint -> DataPoint -> Bool
$c/= :: DataPoint -> DataPoint -> Bool
== :: DataPoint -> DataPoint -> Bool
$c== :: DataPoint -> DataPoint -> Bool
Prelude.Eq, ReadPrec [DataPoint]
ReadPrec DataPoint
Int -> ReadS DataPoint
ReadS [DataPoint]
(Int -> ReadS DataPoint)
-> ReadS [DataPoint]
-> ReadPrec DataPoint
-> ReadPrec [DataPoint]
-> Read DataPoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataPoint]
$creadListPrec :: ReadPrec [DataPoint]
readPrec :: ReadPrec DataPoint
$creadPrec :: ReadPrec DataPoint
readList :: ReadS [DataPoint]
$creadList :: ReadS [DataPoint]
readsPrec :: Int -> ReadS DataPoint
$creadsPrec :: Int -> ReadS DataPoint
Prelude.Read, Int -> DataPoint -> ShowS
[DataPoint] -> ShowS
DataPoint -> String
(Int -> DataPoint -> ShowS)
-> (DataPoint -> String)
-> ([DataPoint] -> ShowS)
-> Show DataPoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataPoint] -> ShowS
$cshowList :: [DataPoint] -> ShowS
show :: DataPoint -> String
$cshow :: DataPoint -> String
showsPrec :: Int -> DataPoint -> ShowS
$cshowsPrec :: Int -> DataPoint -> ShowS
Prelude.Show, (forall x. DataPoint -> Rep DataPoint x)
-> (forall x. Rep DataPoint x -> DataPoint) -> Generic DataPoint
forall x. Rep DataPoint x -> DataPoint
forall x. DataPoint -> Rep DataPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataPoint x -> DataPoint
$cfrom :: forall x. DataPoint -> Rep DataPoint x
Prelude.Generic)
newDataPoint ::
DataPoint
newDataPoint :: DataPoint
newDataPoint =
DataPoint' :: Maybe Double -> Maybe Text -> DataPoint
DataPoint'
{ $sel:value:DataPoint' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:DataPoint' :: Maybe Text
timestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
dataPoint_value :: Lens.Lens' DataPoint (Prelude.Maybe Prelude.Double)
dataPoint_value :: (Maybe Double -> f (Maybe Double)) -> DataPoint -> f DataPoint
dataPoint_value = (DataPoint -> Maybe Double)
-> (DataPoint -> Maybe Double -> DataPoint)
-> Lens DataPoint DataPoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPoint' {Maybe Double
value :: Maybe Double
$sel:value:DataPoint' :: DataPoint -> Maybe Double
value} -> Maybe Double
value) (\s :: DataPoint
s@DataPoint' {} Maybe Double
a -> DataPoint
s {$sel:value:DataPoint' :: Maybe Double
value = Maybe Double
a} :: DataPoint)
dataPoint_timestamp :: Lens.Lens' DataPoint (Prelude.Maybe Prelude.Text)
dataPoint_timestamp :: (Maybe Text -> f (Maybe Text)) -> DataPoint -> f DataPoint
dataPoint_timestamp = (DataPoint -> Maybe Text)
-> (DataPoint -> Maybe Text -> DataPoint)
-> Lens DataPoint DataPoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPoint' {Maybe Text
timestamp :: Maybe Text
$sel:timestamp:DataPoint' :: DataPoint -> Maybe Text
timestamp} -> Maybe Text
timestamp) (\s :: DataPoint
s@DataPoint' {} Maybe Text
a -> DataPoint
s {$sel:timestamp:DataPoint' :: Maybe Text
timestamp = Maybe Text
a} :: DataPoint)
instance Core.FromJSON DataPoint where
parseJSON :: Value -> Parser DataPoint
parseJSON =
String -> (Object -> Parser DataPoint) -> Value -> Parser DataPoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataPoint"
( \Object
x ->
Maybe Double -> Maybe Text -> DataPoint
DataPoint'
(Maybe Double -> Maybe Text -> DataPoint)
-> Parser (Maybe Double) -> Parser (Maybe Text -> DataPoint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
Parser (Maybe Text -> DataPoint)
-> Parser (Maybe Text) -> Parser DataPoint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timestamp")
)
instance Prelude.Hashable DataPoint
instance Prelude.NFData DataPoint