{-# 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.QuickSight.Types.WhatIfPointScenario 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 WhatIfPointScenario = WhatIfPointScenario'
{
WhatIfPointScenario -> POSIX
date :: Data.POSIX,
WhatIfPointScenario -> Double
value :: Prelude.Double
}
deriving (WhatIfPointScenario -> WhatIfPointScenario -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WhatIfPointScenario -> WhatIfPointScenario -> Bool
$c/= :: WhatIfPointScenario -> WhatIfPointScenario -> Bool
== :: WhatIfPointScenario -> WhatIfPointScenario -> Bool
$c== :: WhatIfPointScenario -> WhatIfPointScenario -> Bool
Prelude.Eq, ReadPrec [WhatIfPointScenario]
ReadPrec WhatIfPointScenario
Int -> ReadS WhatIfPointScenario
ReadS [WhatIfPointScenario]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WhatIfPointScenario]
$creadListPrec :: ReadPrec [WhatIfPointScenario]
readPrec :: ReadPrec WhatIfPointScenario
$creadPrec :: ReadPrec WhatIfPointScenario
readList :: ReadS [WhatIfPointScenario]
$creadList :: ReadS [WhatIfPointScenario]
readsPrec :: Int -> ReadS WhatIfPointScenario
$creadsPrec :: Int -> ReadS WhatIfPointScenario
Prelude.Read, Int -> WhatIfPointScenario -> ShowS
[WhatIfPointScenario] -> ShowS
WhatIfPointScenario -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WhatIfPointScenario] -> ShowS
$cshowList :: [WhatIfPointScenario] -> ShowS
show :: WhatIfPointScenario -> String
$cshow :: WhatIfPointScenario -> String
showsPrec :: Int -> WhatIfPointScenario -> ShowS
$cshowsPrec :: Int -> WhatIfPointScenario -> ShowS
Prelude.Show, forall x. Rep WhatIfPointScenario x -> WhatIfPointScenario
forall x. WhatIfPointScenario -> Rep WhatIfPointScenario x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WhatIfPointScenario x -> WhatIfPointScenario
$cfrom :: forall x. WhatIfPointScenario -> Rep WhatIfPointScenario x
Prelude.Generic)
newWhatIfPointScenario ::
Prelude.UTCTime ->
Prelude.Double ->
WhatIfPointScenario
newWhatIfPointScenario :: UTCTime -> Double -> WhatIfPointScenario
newWhatIfPointScenario UTCTime
pDate_ Double
pValue_ =
WhatIfPointScenario'
{ $sel:date:WhatIfPointScenario' :: POSIX
date =
forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pDate_,
$sel:value:WhatIfPointScenario' :: Double
value = Double
pValue_
}
whatIfPointScenario_date :: Lens.Lens' WhatIfPointScenario Prelude.UTCTime
whatIfPointScenario_date :: Lens' WhatIfPointScenario UTCTime
whatIfPointScenario_date = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfPointScenario' {POSIX
date :: POSIX
$sel:date:WhatIfPointScenario' :: WhatIfPointScenario -> POSIX
date} -> POSIX
date) (\s :: WhatIfPointScenario
s@WhatIfPointScenario' {} POSIX
a -> WhatIfPointScenario
s {$sel:date:WhatIfPointScenario' :: POSIX
date = POSIX
a} :: WhatIfPointScenario) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
whatIfPointScenario_value :: Lens.Lens' WhatIfPointScenario Prelude.Double
whatIfPointScenario_value :: Lens' WhatIfPointScenario Double
whatIfPointScenario_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfPointScenario' {Double
value :: Double
$sel:value:WhatIfPointScenario' :: WhatIfPointScenario -> Double
value} -> Double
value) (\s :: WhatIfPointScenario
s@WhatIfPointScenario' {} Double
a -> WhatIfPointScenario
s {$sel:value:WhatIfPointScenario' :: Double
value = Double
a} :: WhatIfPointScenario)
instance Data.FromJSON WhatIfPointScenario where
parseJSON :: Value -> Parser WhatIfPointScenario
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WhatIfPointScenario"
( \Object
x ->
POSIX -> Double -> WhatIfPointScenario
WhatIfPointScenario'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Date")
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 WhatIfPointScenario where
hashWithSalt :: Int -> WhatIfPointScenario -> Int
hashWithSalt Int
_salt WhatIfPointScenario' {Double
POSIX
value :: Double
date :: POSIX
$sel:value:WhatIfPointScenario' :: WhatIfPointScenario -> Double
$sel:date:WhatIfPointScenario' :: WhatIfPointScenario -> POSIX
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
date
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
value
instance Prelude.NFData WhatIfPointScenario where
rnf :: WhatIfPointScenario -> ()
rnf WhatIfPointScenario' {Double
POSIX
value :: Double
date :: POSIX
$sel:value:WhatIfPointScenario' :: WhatIfPointScenario -> Double
$sel:date:WhatIfPointScenario' :: WhatIfPointScenario -> POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf POSIX
date seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
value
instance Data.ToJSON WhatIfPointScenario where
toJSON :: WhatIfPointScenario -> Value
toJSON WhatIfPointScenario' {Double
POSIX
value :: Double
date :: POSIX
$sel:value:WhatIfPointScenario' :: WhatIfPointScenario -> Double
$sel:date:WhatIfPointScenario' :: WhatIfPointScenario -> POSIX
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Date" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
date),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
value)
]
)