{-# 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.VisualPalette 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.DataPathColor
data VisualPalette = VisualPalette'
{
VisualPalette -> Maybe Text
chartColor :: Prelude.Maybe Prelude.Text,
VisualPalette -> Maybe [DataPathColor]
colorMap :: Prelude.Maybe [DataPathColor]
}
deriving (VisualPalette -> VisualPalette -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VisualPalette -> VisualPalette -> Bool
$c/= :: VisualPalette -> VisualPalette -> Bool
== :: VisualPalette -> VisualPalette -> Bool
$c== :: VisualPalette -> VisualPalette -> Bool
Prelude.Eq, Int -> VisualPalette -> ShowS
[VisualPalette] -> ShowS
VisualPalette -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VisualPalette] -> ShowS
$cshowList :: [VisualPalette] -> ShowS
show :: VisualPalette -> String
$cshow :: VisualPalette -> String
showsPrec :: Int -> VisualPalette -> ShowS
$cshowsPrec :: Int -> VisualPalette -> ShowS
Prelude.Show, forall x. Rep VisualPalette x -> VisualPalette
forall x. VisualPalette -> Rep VisualPalette x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VisualPalette x -> VisualPalette
$cfrom :: forall x. VisualPalette -> Rep VisualPalette x
Prelude.Generic)
newVisualPalette ::
VisualPalette
newVisualPalette :: VisualPalette
newVisualPalette =
VisualPalette'
{ $sel:chartColor:VisualPalette' :: Maybe Text
chartColor = forall a. Maybe a
Prelude.Nothing,
$sel:colorMap:VisualPalette' :: Maybe [DataPathColor]
colorMap = forall a. Maybe a
Prelude.Nothing
}
visualPalette_chartColor :: Lens.Lens' VisualPalette (Prelude.Maybe Prelude.Text)
visualPalette_chartColor :: Lens' VisualPalette (Maybe Text)
visualPalette_chartColor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualPalette' {Maybe Text
chartColor :: Maybe Text
$sel:chartColor:VisualPalette' :: VisualPalette -> Maybe Text
chartColor} -> Maybe Text
chartColor) (\s :: VisualPalette
s@VisualPalette' {} Maybe Text
a -> VisualPalette
s {$sel:chartColor:VisualPalette' :: Maybe Text
chartColor = Maybe Text
a} :: VisualPalette)
visualPalette_colorMap :: Lens.Lens' VisualPalette (Prelude.Maybe [DataPathColor])
visualPalette_colorMap :: Lens' VisualPalette (Maybe [DataPathColor])
visualPalette_colorMap = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualPalette' {Maybe [DataPathColor]
colorMap :: Maybe [DataPathColor]
$sel:colorMap:VisualPalette' :: VisualPalette -> Maybe [DataPathColor]
colorMap} -> Maybe [DataPathColor]
colorMap) (\s :: VisualPalette
s@VisualPalette' {} Maybe [DataPathColor]
a -> VisualPalette
s {$sel:colorMap:VisualPalette' :: Maybe [DataPathColor]
colorMap = Maybe [DataPathColor]
a} :: VisualPalette) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON VisualPalette where
parseJSON :: Value -> Parser VisualPalette
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VisualPalette"
( \Object
x ->
Maybe Text -> Maybe [DataPathColor] -> VisualPalette
VisualPalette'
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
"ChartColor")
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
"ColorMap" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable VisualPalette where
hashWithSalt :: Int -> VisualPalette -> Int
hashWithSalt Int
_salt VisualPalette' {Maybe [DataPathColor]
Maybe Text
colorMap :: Maybe [DataPathColor]
chartColor :: Maybe Text
$sel:colorMap:VisualPalette' :: VisualPalette -> Maybe [DataPathColor]
$sel:chartColor:VisualPalette' :: VisualPalette -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
chartColor
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DataPathColor]
colorMap
instance Prelude.NFData VisualPalette where
rnf :: VisualPalette -> ()
rnf VisualPalette' {Maybe [DataPathColor]
Maybe Text
colorMap :: Maybe [DataPathColor]
chartColor :: Maybe Text
$sel:colorMap:VisualPalette' :: VisualPalette -> Maybe [DataPathColor]
$sel:chartColor:VisualPalette' :: VisualPalette -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
chartColor
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DataPathColor]
colorMap
instance Data.ToJSON VisualPalette where
toJSON :: VisualPalette -> Value
toJSON VisualPalette' {Maybe [DataPathColor]
Maybe Text
colorMap :: Maybe [DataPathColor]
chartColor :: Maybe Text
$sel:colorMap:VisualPalette' :: VisualPalette -> Maybe [DataPathColor]
$sel:chartColor:VisualPalette' :: VisualPalette -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ChartColor" 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
chartColor,
(Key
"ColorMap" 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 [DataPathColor]
colorMap
]
)