{-# 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.DataPathColor 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
import Amazonka.QuickSight.Types.DataPathValue
import Amazonka.QuickSight.Types.TimeGranularity
data DataPathColor = DataPathColor'
{
DataPathColor -> Maybe TimeGranularity
timeGranularity :: Prelude.Maybe TimeGranularity,
DataPathColor -> DataPathValue
element :: DataPathValue,
DataPathColor -> Text
color :: Prelude.Text
}
deriving (DataPathColor -> DataPathColor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataPathColor -> DataPathColor -> Bool
$c/= :: DataPathColor -> DataPathColor -> Bool
== :: DataPathColor -> DataPathColor -> Bool
$c== :: DataPathColor -> DataPathColor -> Bool
Prelude.Eq, Int -> DataPathColor -> ShowS
[DataPathColor] -> ShowS
DataPathColor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataPathColor] -> ShowS
$cshowList :: [DataPathColor] -> ShowS
show :: DataPathColor -> String
$cshow :: DataPathColor -> String
showsPrec :: Int -> DataPathColor -> ShowS
$cshowsPrec :: Int -> DataPathColor -> ShowS
Prelude.Show, forall x. Rep DataPathColor x -> DataPathColor
forall x. DataPathColor -> Rep DataPathColor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataPathColor x -> DataPathColor
$cfrom :: forall x. DataPathColor -> Rep DataPathColor x
Prelude.Generic)
newDataPathColor ::
DataPathValue ->
Prelude.Text ->
DataPathColor
newDataPathColor :: DataPathValue -> Text -> DataPathColor
newDataPathColor DataPathValue
pElement_ Text
pColor_ =
DataPathColor'
{ $sel:timeGranularity:DataPathColor' :: Maybe TimeGranularity
timeGranularity = forall a. Maybe a
Prelude.Nothing,
$sel:element:DataPathColor' :: DataPathValue
element = DataPathValue
pElement_,
$sel:color:DataPathColor' :: Text
color = Text
pColor_
}
dataPathColor_timeGranularity :: Lens.Lens' DataPathColor (Prelude.Maybe TimeGranularity)
dataPathColor_timeGranularity :: Lens' DataPathColor (Maybe TimeGranularity)
dataPathColor_timeGranularity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPathColor' {Maybe TimeGranularity
timeGranularity :: Maybe TimeGranularity
$sel:timeGranularity:DataPathColor' :: DataPathColor -> Maybe TimeGranularity
timeGranularity} -> Maybe TimeGranularity
timeGranularity) (\s :: DataPathColor
s@DataPathColor' {} Maybe TimeGranularity
a -> DataPathColor
s {$sel:timeGranularity:DataPathColor' :: Maybe TimeGranularity
timeGranularity = Maybe TimeGranularity
a} :: DataPathColor)
dataPathColor_element :: Lens.Lens' DataPathColor DataPathValue
dataPathColor_element :: Lens' DataPathColor DataPathValue
dataPathColor_element = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPathColor' {DataPathValue
element :: DataPathValue
$sel:element:DataPathColor' :: DataPathColor -> DataPathValue
element} -> DataPathValue
element) (\s :: DataPathColor
s@DataPathColor' {} DataPathValue
a -> DataPathColor
s {$sel:element:DataPathColor' :: DataPathValue
element = DataPathValue
a} :: DataPathColor)
dataPathColor_color :: Lens.Lens' DataPathColor Prelude.Text
dataPathColor_color :: Lens' DataPathColor Text
dataPathColor_color = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPathColor' {Text
color :: Text
$sel:color:DataPathColor' :: DataPathColor -> Text
color} -> Text
color) (\s :: DataPathColor
s@DataPathColor' {} Text
a -> DataPathColor
s {$sel:color:DataPathColor' :: Text
color = Text
a} :: DataPathColor)
instance Data.FromJSON DataPathColor where
parseJSON :: Value -> Parser DataPathColor
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DataPathColor"
( \Object
x ->
Maybe TimeGranularity -> DataPathValue -> Text -> DataPathColor
DataPathColor'
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
"TimeGranularity")
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
"Element")
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
"Color")
)
instance Prelude.Hashable DataPathColor where
hashWithSalt :: Int -> DataPathColor -> Int
hashWithSalt Int
_salt DataPathColor' {Maybe TimeGranularity
Text
DataPathValue
color :: Text
element :: DataPathValue
timeGranularity :: Maybe TimeGranularity
$sel:color:DataPathColor' :: DataPathColor -> Text
$sel:element:DataPathColor' :: DataPathColor -> DataPathValue
$sel:timeGranularity:DataPathColor' :: DataPathColor -> Maybe TimeGranularity
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeGranularity
timeGranularity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataPathValue
element
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
color
instance Prelude.NFData DataPathColor where
rnf :: DataPathColor -> ()
rnf DataPathColor' {Maybe TimeGranularity
Text
DataPathValue
color :: Text
element :: DataPathValue
timeGranularity :: Maybe TimeGranularity
$sel:color:DataPathColor' :: DataPathColor -> Text
$sel:element:DataPathColor' :: DataPathColor -> DataPathValue
$sel:timeGranularity:DataPathColor' :: DataPathColor -> Maybe TimeGranularity
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeGranularity
timeGranularity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataPathValue
element
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
color
instance Data.ToJSON DataPathColor where
toJSON :: DataPathColor -> Value
toJSON DataPathColor' {Maybe TimeGranularity
Text
DataPathValue
color :: Text
element :: DataPathValue
timeGranularity :: Maybe TimeGranularity
$sel:color:DataPathColor' :: DataPathColor -> Text
$sel:element:DataPathColor' :: DataPathColor -> DataPathValue
$sel:timeGranularity:DataPathColor' :: DataPathColor -> Maybe TimeGranularity
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"TimeGranularity" 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 TimeGranularity
timeGranularity,
forall a. a -> Maybe a
Prelude.Just (Key
"Element" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataPathValue
element),
forall a. a -> Maybe a
Prelude.Just (Key
"Color" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
color)
]
)