{-# 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.SheetStyle
-- 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.SheetStyle where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.TileLayoutStyle
import Amazonka.QuickSight.Types.TileStyle

-- | The theme display options for sheets.
--
-- /See:/ 'newSheetStyle' smart constructor.
data SheetStyle = SheetStyle'
  { -- | The layout options for tiles.
    SheetStyle -> Maybe TileLayoutStyle
tileLayout :: Prelude.Maybe TileLayoutStyle,
    -- | The display options for tiles.
    SheetStyle -> Maybe TileStyle
tile :: Prelude.Maybe TileStyle
  }
  deriving (SheetStyle -> SheetStyle -> Bool
(SheetStyle -> SheetStyle -> Bool)
-> (SheetStyle -> SheetStyle -> Bool) -> Eq SheetStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SheetStyle -> SheetStyle -> Bool
$c/= :: SheetStyle -> SheetStyle -> Bool
== :: SheetStyle -> SheetStyle -> Bool
$c== :: SheetStyle -> SheetStyle -> Bool
Prelude.Eq, ReadPrec [SheetStyle]
ReadPrec SheetStyle
Int -> ReadS SheetStyle
ReadS [SheetStyle]
(Int -> ReadS SheetStyle)
-> ReadS [SheetStyle]
-> ReadPrec SheetStyle
-> ReadPrec [SheetStyle]
-> Read SheetStyle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SheetStyle]
$creadListPrec :: ReadPrec [SheetStyle]
readPrec :: ReadPrec SheetStyle
$creadPrec :: ReadPrec SheetStyle
readList :: ReadS [SheetStyle]
$creadList :: ReadS [SheetStyle]
readsPrec :: Int -> ReadS SheetStyle
$creadsPrec :: Int -> ReadS SheetStyle
Prelude.Read, Int -> SheetStyle -> ShowS
[SheetStyle] -> ShowS
SheetStyle -> String
(Int -> SheetStyle -> ShowS)
-> (SheetStyle -> String)
-> ([SheetStyle] -> ShowS)
-> Show SheetStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SheetStyle] -> ShowS
$cshowList :: [SheetStyle] -> ShowS
show :: SheetStyle -> String
$cshow :: SheetStyle -> String
showsPrec :: Int -> SheetStyle -> ShowS
$cshowsPrec :: Int -> SheetStyle -> ShowS
Prelude.Show, (forall x. SheetStyle -> Rep SheetStyle x)
-> (forall x. Rep SheetStyle x -> SheetStyle) -> Generic SheetStyle
forall x. Rep SheetStyle x -> SheetStyle
forall x. SheetStyle -> Rep SheetStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SheetStyle x -> SheetStyle
$cfrom :: forall x. SheetStyle -> Rep SheetStyle x
Prelude.Generic)

-- |
-- Create a value of 'SheetStyle' 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:
--
-- 'tileLayout', 'sheetStyle_tileLayout' - The layout options for tiles.
--
-- 'tile', 'sheetStyle_tile' - The display options for tiles.
newSheetStyle ::
  SheetStyle
newSheetStyle :: SheetStyle
newSheetStyle =
  SheetStyle' :: Maybe TileLayoutStyle -> Maybe TileStyle -> SheetStyle
SheetStyle'
    { $sel:tileLayout:SheetStyle' :: Maybe TileLayoutStyle
tileLayout = Maybe TileLayoutStyle
forall a. Maybe a
Prelude.Nothing,
      $sel:tile:SheetStyle' :: Maybe TileStyle
tile = Maybe TileStyle
forall a. Maybe a
Prelude.Nothing
    }

-- | The layout options for tiles.
sheetStyle_tileLayout :: Lens.Lens' SheetStyle (Prelude.Maybe TileLayoutStyle)
sheetStyle_tileLayout :: (Maybe TileLayoutStyle -> f (Maybe TileLayoutStyle))
-> SheetStyle -> f SheetStyle
sheetStyle_tileLayout = (SheetStyle -> Maybe TileLayoutStyle)
-> (SheetStyle -> Maybe TileLayoutStyle -> SheetStyle)
-> Lens
     SheetStyle
     SheetStyle
     (Maybe TileLayoutStyle)
     (Maybe TileLayoutStyle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetStyle' {Maybe TileLayoutStyle
tileLayout :: Maybe TileLayoutStyle
$sel:tileLayout:SheetStyle' :: SheetStyle -> Maybe TileLayoutStyle
tileLayout} -> Maybe TileLayoutStyle
tileLayout) (\s :: SheetStyle
s@SheetStyle' {} Maybe TileLayoutStyle
a -> SheetStyle
s {$sel:tileLayout:SheetStyle' :: Maybe TileLayoutStyle
tileLayout = Maybe TileLayoutStyle
a} :: SheetStyle)

-- | The display options for tiles.
sheetStyle_tile :: Lens.Lens' SheetStyle (Prelude.Maybe TileStyle)
sheetStyle_tile :: (Maybe TileStyle -> f (Maybe TileStyle))
-> SheetStyle -> f SheetStyle
sheetStyle_tile = (SheetStyle -> Maybe TileStyle)
-> (SheetStyle -> Maybe TileStyle -> SheetStyle)
-> Lens SheetStyle SheetStyle (Maybe TileStyle) (Maybe TileStyle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetStyle' {Maybe TileStyle
tile :: Maybe TileStyle
$sel:tile:SheetStyle' :: SheetStyle -> Maybe TileStyle
tile} -> Maybe TileStyle
tile) (\s :: SheetStyle
s@SheetStyle' {} Maybe TileStyle
a -> SheetStyle
s {$sel:tile:SheetStyle' :: Maybe TileStyle
tile = Maybe TileStyle
a} :: SheetStyle)

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

instance Prelude.Hashable SheetStyle

instance Prelude.NFData SheetStyle

instance Core.ToJSON SheetStyle where
  toJSON :: SheetStyle -> Value
toJSON SheetStyle' {Maybe TileLayoutStyle
Maybe TileStyle
tile :: Maybe TileStyle
tileLayout :: Maybe TileLayoutStyle
$sel:tile:SheetStyle' :: SheetStyle -> Maybe TileStyle
$sel:tileLayout:SheetStyle' :: SheetStyle -> Maybe TileLayoutStyle
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TileLayout" Text -> TileLayoutStyle -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TileLayoutStyle -> Pair) -> Maybe TileLayoutStyle -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TileLayoutStyle
tileLayout,
            (Text
"Tile" Text -> TileStyle -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TileStyle -> Pair) -> Maybe TileStyle -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TileStyle
tile
          ]
      )