{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.Types.ThemeConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.ThemeConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.DataColorPalette
import Amazonka.QuickSight.Types.SheetStyle
import Amazonka.QuickSight.Types.UIColorPalette

-- | The theme configuration. This configuration contains all of the display
-- properties for a theme.
--
-- /See:/ 'newThemeConfiguration' smart constructor.
data ThemeConfiguration = ThemeConfiguration'
  { -- | Color properties that apply to the UI and to charts, excluding the
    -- colors that apply to data.
    ThemeConfiguration -> Maybe UIColorPalette
uIColorPalette :: Prelude.Maybe UIColorPalette,
    -- | Display options related to sheets.
    ThemeConfiguration -> Maybe SheetStyle
sheet :: Prelude.Maybe SheetStyle,
    -- | Color properties that apply to chart data colors.
    ThemeConfiguration -> Maybe DataColorPalette
dataColorPalette :: Prelude.Maybe DataColorPalette
  }
  deriving (ThemeConfiguration -> ThemeConfiguration -> Bool
(ThemeConfiguration -> ThemeConfiguration -> Bool)
-> (ThemeConfiguration -> ThemeConfiguration -> Bool)
-> Eq ThemeConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThemeConfiguration -> ThemeConfiguration -> Bool
$c/= :: ThemeConfiguration -> ThemeConfiguration -> Bool
== :: ThemeConfiguration -> ThemeConfiguration -> Bool
$c== :: ThemeConfiguration -> ThemeConfiguration -> Bool
Prelude.Eq, ReadPrec [ThemeConfiguration]
ReadPrec ThemeConfiguration
Int -> ReadS ThemeConfiguration
ReadS [ThemeConfiguration]
(Int -> ReadS ThemeConfiguration)
-> ReadS [ThemeConfiguration]
-> ReadPrec ThemeConfiguration
-> ReadPrec [ThemeConfiguration]
-> Read ThemeConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThemeConfiguration]
$creadListPrec :: ReadPrec [ThemeConfiguration]
readPrec :: ReadPrec ThemeConfiguration
$creadPrec :: ReadPrec ThemeConfiguration
readList :: ReadS [ThemeConfiguration]
$creadList :: ReadS [ThemeConfiguration]
readsPrec :: Int -> ReadS ThemeConfiguration
$creadsPrec :: Int -> ReadS ThemeConfiguration
Prelude.Read, Int -> ThemeConfiguration -> ShowS
[ThemeConfiguration] -> ShowS
ThemeConfiguration -> String
(Int -> ThemeConfiguration -> ShowS)
-> (ThemeConfiguration -> String)
-> ([ThemeConfiguration] -> ShowS)
-> Show ThemeConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThemeConfiguration] -> ShowS
$cshowList :: [ThemeConfiguration] -> ShowS
show :: ThemeConfiguration -> String
$cshow :: ThemeConfiguration -> String
showsPrec :: Int -> ThemeConfiguration -> ShowS
$cshowsPrec :: Int -> ThemeConfiguration -> ShowS
Prelude.Show, (forall x. ThemeConfiguration -> Rep ThemeConfiguration x)
-> (forall x. Rep ThemeConfiguration x -> ThemeConfiguration)
-> Generic ThemeConfiguration
forall x. Rep ThemeConfiguration x -> ThemeConfiguration
forall x. ThemeConfiguration -> Rep ThemeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThemeConfiguration x -> ThemeConfiguration
$cfrom :: forall x. ThemeConfiguration -> Rep ThemeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ThemeConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'uIColorPalette', 'themeConfiguration_uIColorPalette' - Color properties that apply to the UI and to charts, excluding the
-- colors that apply to data.
--
-- 'sheet', 'themeConfiguration_sheet' - Display options related to sheets.
--
-- 'dataColorPalette', 'themeConfiguration_dataColorPalette' - Color properties that apply to chart data colors.
newThemeConfiguration ::
  ThemeConfiguration
newThemeConfiguration :: ThemeConfiguration
newThemeConfiguration =
  ThemeConfiguration' :: Maybe UIColorPalette
-> Maybe SheetStyle -> Maybe DataColorPalette -> ThemeConfiguration
ThemeConfiguration'
    { $sel:uIColorPalette:ThemeConfiguration' :: Maybe UIColorPalette
uIColorPalette =
        Maybe UIColorPalette
forall a. Maybe a
Prelude.Nothing,
      $sel:sheet:ThemeConfiguration' :: Maybe SheetStyle
sheet = Maybe SheetStyle
forall a. Maybe a
Prelude.Nothing,
      $sel:dataColorPalette:ThemeConfiguration' :: Maybe DataColorPalette
dataColorPalette = Maybe DataColorPalette
forall a. Maybe a
Prelude.Nothing
    }

-- | Color properties that apply to the UI and to charts, excluding the
-- colors that apply to data.
themeConfiguration_uIColorPalette :: Lens.Lens' ThemeConfiguration (Prelude.Maybe UIColorPalette)
themeConfiguration_uIColorPalette :: (Maybe UIColorPalette -> f (Maybe UIColorPalette))
-> ThemeConfiguration -> f ThemeConfiguration
themeConfiguration_uIColorPalette = (ThemeConfiguration -> Maybe UIColorPalette)
-> (ThemeConfiguration
    -> Maybe UIColorPalette -> ThemeConfiguration)
-> Lens
     ThemeConfiguration
     ThemeConfiguration
     (Maybe UIColorPalette)
     (Maybe UIColorPalette)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThemeConfiguration' {Maybe UIColorPalette
uIColorPalette :: Maybe UIColorPalette
$sel:uIColorPalette:ThemeConfiguration' :: ThemeConfiguration -> Maybe UIColorPalette
uIColorPalette} -> Maybe UIColorPalette
uIColorPalette) (\s :: ThemeConfiguration
s@ThemeConfiguration' {} Maybe UIColorPalette
a -> ThemeConfiguration
s {$sel:uIColorPalette:ThemeConfiguration' :: Maybe UIColorPalette
uIColorPalette = Maybe UIColorPalette
a} :: ThemeConfiguration)

-- | Display options related to sheets.
themeConfiguration_sheet :: Lens.Lens' ThemeConfiguration (Prelude.Maybe SheetStyle)
themeConfiguration_sheet :: (Maybe SheetStyle -> f (Maybe SheetStyle))
-> ThemeConfiguration -> f ThemeConfiguration
themeConfiguration_sheet = (ThemeConfiguration -> Maybe SheetStyle)
-> (ThemeConfiguration -> Maybe SheetStyle -> ThemeConfiguration)
-> Lens
     ThemeConfiguration
     ThemeConfiguration
     (Maybe SheetStyle)
     (Maybe SheetStyle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThemeConfiguration' {Maybe SheetStyle
sheet :: Maybe SheetStyle
$sel:sheet:ThemeConfiguration' :: ThemeConfiguration -> Maybe SheetStyle
sheet} -> Maybe SheetStyle
sheet) (\s :: ThemeConfiguration
s@ThemeConfiguration' {} Maybe SheetStyle
a -> ThemeConfiguration
s {$sel:sheet:ThemeConfiguration' :: Maybe SheetStyle
sheet = Maybe SheetStyle
a} :: ThemeConfiguration)

-- | Color properties that apply to chart data colors.
themeConfiguration_dataColorPalette :: Lens.Lens' ThemeConfiguration (Prelude.Maybe DataColorPalette)
themeConfiguration_dataColorPalette :: (Maybe DataColorPalette -> f (Maybe DataColorPalette))
-> ThemeConfiguration -> f ThemeConfiguration
themeConfiguration_dataColorPalette = (ThemeConfiguration -> Maybe DataColorPalette)
-> (ThemeConfiguration
    -> Maybe DataColorPalette -> ThemeConfiguration)
-> Lens
     ThemeConfiguration
     ThemeConfiguration
     (Maybe DataColorPalette)
     (Maybe DataColorPalette)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThemeConfiguration' {Maybe DataColorPalette
dataColorPalette :: Maybe DataColorPalette
$sel:dataColorPalette:ThemeConfiguration' :: ThemeConfiguration -> Maybe DataColorPalette
dataColorPalette} -> Maybe DataColorPalette
dataColorPalette) (\s :: ThemeConfiguration
s@ThemeConfiguration' {} Maybe DataColorPalette
a -> ThemeConfiguration
s {$sel:dataColorPalette:ThemeConfiguration' :: Maybe DataColorPalette
dataColorPalette = Maybe DataColorPalette
a} :: ThemeConfiguration)

instance Core.FromJSON ThemeConfiguration where
  parseJSON :: Value -> Parser ThemeConfiguration
parseJSON =
    String
-> (Object -> Parser ThemeConfiguration)
-> Value
-> Parser ThemeConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ThemeConfiguration"
      ( \Object
x ->
          Maybe UIColorPalette
-> Maybe SheetStyle -> Maybe DataColorPalette -> ThemeConfiguration
ThemeConfiguration'
            (Maybe UIColorPalette
 -> Maybe SheetStyle
 -> Maybe DataColorPalette
 -> ThemeConfiguration)
-> Parser (Maybe UIColorPalette)
-> Parser
     (Maybe SheetStyle -> Maybe DataColorPalette -> ThemeConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UIColorPalette)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UIColorPalette")
            Parser
  (Maybe SheetStyle -> Maybe DataColorPalette -> ThemeConfiguration)
-> Parser (Maybe SheetStyle)
-> Parser (Maybe DataColorPalette -> ThemeConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SheetStyle)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Sheet")
            Parser (Maybe DataColorPalette -> ThemeConfiguration)
-> Parser (Maybe DataColorPalette) -> Parser ThemeConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataColorPalette)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataColorPalette")
      )

instance Prelude.Hashable ThemeConfiguration

instance Prelude.NFData ThemeConfiguration

instance Core.ToJSON ThemeConfiguration where
  toJSON :: ThemeConfiguration -> Value
toJSON ThemeConfiguration' {Maybe DataColorPalette
Maybe SheetStyle
Maybe UIColorPalette
dataColorPalette :: Maybe DataColorPalette
sheet :: Maybe SheetStyle
uIColorPalette :: Maybe UIColorPalette
$sel:dataColorPalette:ThemeConfiguration' :: ThemeConfiguration -> Maybe DataColorPalette
$sel:sheet:ThemeConfiguration' :: ThemeConfiguration -> Maybe SheetStyle
$sel:uIColorPalette:ThemeConfiguration' :: ThemeConfiguration -> Maybe UIColorPalette
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UIColorPalette" Text -> UIColorPalette -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UIColorPalette -> Pair) -> Maybe UIColorPalette -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UIColorPalette
uIColorPalette,
            (Text
"Sheet" Text -> SheetStyle -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SheetStyle -> Pair) -> Maybe SheetStyle -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SheetStyle
sheet,
            (Text
"DataColorPalette" Text -> DataColorPalette -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DataColorPalette -> Pair) -> Maybe DataColorPalette -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataColorPalette
dataColorPalette
          ]
      )