{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.SheetStyle 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.TileLayoutStyle
import Amazonka.QuickSight.Types.TileStyle

-- | The theme display options for sheets.
--
-- /See:/ 'newSheetStyle' smart constructor.
data SheetStyle = SheetStyle'
  { -- | The display options for tiles.
    SheetStyle -> Maybe TileStyle
tile :: Prelude.Maybe TileStyle,
    -- | The layout options for tiles.
    SheetStyle -> Maybe TileLayoutStyle
tileLayout :: Prelude.Maybe TileLayoutStyle
  }
  deriving (SheetStyle -> SheetStyle -> Bool
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]
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
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. 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:
--
-- 'tile', 'sheetStyle_tile' - The display options for tiles.
--
-- 'tileLayout', 'sheetStyle_tileLayout' - The layout options for tiles.
newSheetStyle ::
  SheetStyle
newSheetStyle :: SheetStyle
newSheetStyle =
  SheetStyle'
    { $sel:tile:SheetStyle' :: Maybe TileStyle
tile = forall a. Maybe a
Prelude.Nothing,
      $sel:tileLayout:SheetStyle' :: Maybe TileLayoutStyle
tileLayout = forall a. Maybe a
Prelude.Nothing
    }

-- | The display options for tiles.
sheetStyle_tile :: Lens.Lens' SheetStyle (Prelude.Maybe TileStyle)
sheetStyle_tile :: Lens' SheetStyle (Maybe TileStyle)
sheetStyle_tile = 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)

-- | The layout options for tiles.
sheetStyle_tileLayout :: Lens.Lens' SheetStyle (Prelude.Maybe TileLayoutStyle)
sheetStyle_tileLayout :: Lens' SheetStyle (Maybe TileLayoutStyle)
sheetStyle_tileLayout = 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)

instance Data.FromJSON SheetStyle where
  parseJSON :: Value -> Parser SheetStyle
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SheetStyle"
      ( \Object
x ->
          Maybe TileStyle -> Maybe TileLayoutStyle -> SheetStyle
SheetStyle'
            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
"Tile")
            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
"TileLayout")
      )

instance Prelude.Hashable SheetStyle where
  hashWithSalt :: Int -> SheetStyle -> Int
hashWithSalt Int
_salt SheetStyle' {Maybe TileLayoutStyle
Maybe TileStyle
tileLayout :: Maybe TileLayoutStyle
tile :: Maybe TileStyle
$sel:tileLayout:SheetStyle' :: SheetStyle -> Maybe TileLayoutStyle
$sel:tile:SheetStyle' :: SheetStyle -> Maybe TileStyle
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TileStyle
tile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TileLayoutStyle
tileLayout

instance Prelude.NFData SheetStyle where
  rnf :: SheetStyle -> ()
rnf SheetStyle' {Maybe TileLayoutStyle
Maybe TileStyle
tileLayout :: Maybe TileLayoutStyle
tile :: Maybe TileStyle
$sel:tileLayout:SheetStyle' :: SheetStyle -> Maybe TileLayoutStyle
$sel:tile:SheetStyle' :: SheetStyle -> Maybe TileStyle
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TileStyle
tile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TileLayoutStyle
tileLayout

instance Data.ToJSON SheetStyle where
  toJSON :: SheetStyle -> Value
toJSON SheetStyle' {Maybe TileLayoutStyle
Maybe TileStyle
tileLayout :: Maybe TileLayoutStyle
tile :: Maybe TileStyle
$sel:tileLayout:SheetStyle' :: SheetStyle -> Maybe TileLayoutStyle
$sel:tile:SheetStyle' :: SheetStyle -> Maybe TileStyle
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Tile" 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 TileStyle
tile,
            (Key
"TileLayout" 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 TileLayoutStyle
tileLayout
          ]
      )