{-# 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.GradientStop 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 GradientStop = GradientStop'
{
GradientStop -> Maybe Text
color :: Prelude.Maybe Prelude.Text,
GradientStop -> Maybe Double
dataValue :: Prelude.Maybe Prelude.Double,
GradientStop -> Double
gradientOffset :: Prelude.Double
}
deriving (GradientStop -> GradientStop -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GradientStop -> GradientStop -> Bool
$c/= :: GradientStop -> GradientStop -> Bool
== :: GradientStop -> GradientStop -> Bool
$c== :: GradientStop -> GradientStop -> Bool
Prelude.Eq, ReadPrec [GradientStop]
ReadPrec GradientStop
Int -> ReadS GradientStop
ReadS [GradientStop]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GradientStop]
$creadListPrec :: ReadPrec [GradientStop]
readPrec :: ReadPrec GradientStop
$creadPrec :: ReadPrec GradientStop
readList :: ReadS [GradientStop]
$creadList :: ReadS [GradientStop]
readsPrec :: Int -> ReadS GradientStop
$creadsPrec :: Int -> ReadS GradientStop
Prelude.Read, Int -> GradientStop -> ShowS
[GradientStop] -> ShowS
GradientStop -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GradientStop] -> ShowS
$cshowList :: [GradientStop] -> ShowS
show :: GradientStop -> String
$cshow :: GradientStop -> String
showsPrec :: Int -> GradientStop -> ShowS
$cshowsPrec :: Int -> GradientStop -> ShowS
Prelude.Show, forall x. Rep GradientStop x -> GradientStop
forall x. GradientStop -> Rep GradientStop x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GradientStop x -> GradientStop
$cfrom :: forall x. GradientStop -> Rep GradientStop x
Prelude.Generic)
newGradientStop ::
Prelude.Double ->
GradientStop
newGradientStop :: Double -> GradientStop
newGradientStop Double
pGradientOffset_ =
GradientStop'
{ $sel:color:GradientStop' :: Maybe Text
color = forall a. Maybe a
Prelude.Nothing,
$sel:dataValue:GradientStop' :: Maybe Double
dataValue = forall a. Maybe a
Prelude.Nothing,
$sel:gradientOffset:GradientStop' :: Double
gradientOffset = Double
pGradientOffset_
}
gradientStop_color :: Lens.Lens' GradientStop (Prelude.Maybe Prelude.Text)
gradientStop_color :: Lens' GradientStop (Maybe Text)
gradientStop_color = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GradientStop' {Maybe Text
color :: Maybe Text
$sel:color:GradientStop' :: GradientStop -> Maybe Text
color} -> Maybe Text
color) (\s :: GradientStop
s@GradientStop' {} Maybe Text
a -> GradientStop
s {$sel:color:GradientStop' :: Maybe Text
color = Maybe Text
a} :: GradientStop)
gradientStop_dataValue :: Lens.Lens' GradientStop (Prelude.Maybe Prelude.Double)
gradientStop_dataValue :: Lens' GradientStop (Maybe Double)
gradientStop_dataValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GradientStop' {Maybe Double
dataValue :: Maybe Double
$sel:dataValue:GradientStop' :: GradientStop -> Maybe Double
dataValue} -> Maybe Double
dataValue) (\s :: GradientStop
s@GradientStop' {} Maybe Double
a -> GradientStop
s {$sel:dataValue:GradientStop' :: Maybe Double
dataValue = Maybe Double
a} :: GradientStop)
gradientStop_gradientOffset :: Lens.Lens' GradientStop Prelude.Double
gradientStop_gradientOffset :: Lens' GradientStop Double
gradientStop_gradientOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GradientStop' {Double
gradientOffset :: Double
$sel:gradientOffset:GradientStop' :: GradientStop -> Double
gradientOffset} -> Double
gradientOffset) (\s :: GradientStop
s@GradientStop' {} Double
a -> GradientStop
s {$sel:gradientOffset:GradientStop' :: Double
gradientOffset = Double
a} :: GradientStop)
instance Data.FromJSON GradientStop where
parseJSON :: Value -> Parser GradientStop
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GradientStop"
( \Object
x ->
Maybe Text -> Maybe Double -> Double -> GradientStop
GradientStop'
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
"Color")
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
"DataValue")
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
"GradientOffset")
)
instance Prelude.Hashable GradientStop where
hashWithSalt :: Int -> GradientStop -> Int
hashWithSalt Int
_salt GradientStop' {Double
Maybe Double
Maybe Text
gradientOffset :: Double
dataValue :: Maybe Double
color :: Maybe Text
$sel:gradientOffset:GradientStop' :: GradientStop -> Double
$sel:dataValue:GradientStop' :: GradientStop -> Maybe Double
$sel:color:GradientStop' :: GradientStop -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
color
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
dataValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
gradientOffset
instance Prelude.NFData GradientStop where
rnf :: GradientStop -> ()
rnf GradientStop' {Double
Maybe Double
Maybe Text
gradientOffset :: Double
dataValue :: Maybe Double
color :: Maybe Text
$sel:gradientOffset:GradientStop' :: GradientStop -> Double
$sel:dataValue:GradientStop' :: GradientStop -> Maybe Double
$sel:color:GradientStop' :: GradientStop -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
color
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
dataValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
gradientOffset
instance Data.ToJSON GradientStop where
toJSON :: GradientStop -> Value
toJSON GradientStop' {Double
Maybe Double
Maybe Text
gradientOffset :: Double
dataValue :: Maybe Double
color :: Maybe Text
$sel:gradientOffset:GradientStop' :: GradientStop -> Double
$sel:dataValue:GradientStop' :: GradientStop -> Maybe Double
$sel:color:GradientStop' :: GradientStop -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Color" 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 Text
color,
(Key
"DataValue" 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 Double
dataValue,
forall a. a -> Maybe a
Prelude.Just
(Key
"GradientOffset" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
gradientOffset)
]
)