{-# 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.TableOptions
-- 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.TableOptions 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.RowAlternateColorOptions
import Amazonka.QuickSight.Types.TableCellStyle
import Amazonka.QuickSight.Types.TableOrientation

-- | The table options for a table visual.
--
-- /See:/ 'newTableOptions' smart constructor.
data TableOptions = TableOptions'
  { -- | The table cell style of table cells.
    TableOptions -> Maybe TableCellStyle
cellStyle :: Prelude.Maybe TableCellStyle,
    -- | The table cell style of a table header.
    TableOptions -> Maybe TableCellStyle
headerStyle :: Prelude.Maybe TableCellStyle,
    -- | The orientation (vertical, horizontal) for a table.
    TableOptions -> Maybe TableOrientation
orientation :: Prelude.Maybe TableOrientation,
    -- | The row alternate color options (widget status, row alternate colors)
    -- for a table.
    TableOptions -> Maybe RowAlternateColorOptions
rowAlternateColorOptions :: Prelude.Maybe RowAlternateColorOptions
  }
  deriving (TableOptions -> TableOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableOptions -> TableOptions -> Bool
$c/= :: TableOptions -> TableOptions -> Bool
== :: TableOptions -> TableOptions -> Bool
$c== :: TableOptions -> TableOptions -> Bool
Prelude.Eq, ReadPrec [TableOptions]
ReadPrec TableOptions
Int -> ReadS TableOptions
ReadS [TableOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableOptions]
$creadListPrec :: ReadPrec [TableOptions]
readPrec :: ReadPrec TableOptions
$creadPrec :: ReadPrec TableOptions
readList :: ReadS [TableOptions]
$creadList :: ReadS [TableOptions]
readsPrec :: Int -> ReadS TableOptions
$creadsPrec :: Int -> ReadS TableOptions
Prelude.Read, Int -> TableOptions -> ShowS
[TableOptions] -> ShowS
TableOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableOptions] -> ShowS
$cshowList :: [TableOptions] -> ShowS
show :: TableOptions -> String
$cshow :: TableOptions -> String
showsPrec :: Int -> TableOptions -> ShowS
$cshowsPrec :: Int -> TableOptions -> ShowS
Prelude.Show, forall x. Rep TableOptions x -> TableOptions
forall x. TableOptions -> Rep TableOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableOptions x -> TableOptions
$cfrom :: forall x. TableOptions -> Rep TableOptions x
Prelude.Generic)

-- |
-- Create a value of 'TableOptions' 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:
--
-- 'cellStyle', 'tableOptions_cellStyle' - The table cell style of table cells.
--
-- 'headerStyle', 'tableOptions_headerStyle' - The table cell style of a table header.
--
-- 'orientation', 'tableOptions_orientation' - The orientation (vertical, horizontal) for a table.
--
-- 'rowAlternateColorOptions', 'tableOptions_rowAlternateColorOptions' - The row alternate color options (widget status, row alternate colors)
-- for a table.
newTableOptions ::
  TableOptions
newTableOptions :: TableOptions
newTableOptions =
  TableOptions'
    { $sel:cellStyle:TableOptions' :: Maybe TableCellStyle
cellStyle = forall a. Maybe a
Prelude.Nothing,
      $sel:headerStyle:TableOptions' :: Maybe TableCellStyle
headerStyle = forall a. Maybe a
Prelude.Nothing,
      $sel:orientation:TableOptions' :: Maybe TableOrientation
orientation = forall a. Maybe a
Prelude.Nothing,
      $sel:rowAlternateColorOptions:TableOptions' :: Maybe RowAlternateColorOptions
rowAlternateColorOptions = forall a. Maybe a
Prelude.Nothing
    }

-- | The table cell style of table cells.
tableOptions_cellStyle :: Lens.Lens' TableOptions (Prelude.Maybe TableCellStyle)
tableOptions_cellStyle :: Lens' TableOptions (Maybe TableCellStyle)
tableOptions_cellStyle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableOptions' {Maybe TableCellStyle
cellStyle :: Maybe TableCellStyle
$sel:cellStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
cellStyle} -> Maybe TableCellStyle
cellStyle) (\s :: TableOptions
s@TableOptions' {} Maybe TableCellStyle
a -> TableOptions
s {$sel:cellStyle:TableOptions' :: Maybe TableCellStyle
cellStyle = Maybe TableCellStyle
a} :: TableOptions)

-- | The table cell style of a table header.
tableOptions_headerStyle :: Lens.Lens' TableOptions (Prelude.Maybe TableCellStyle)
tableOptions_headerStyle :: Lens' TableOptions (Maybe TableCellStyle)
tableOptions_headerStyle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableOptions' {Maybe TableCellStyle
headerStyle :: Maybe TableCellStyle
$sel:headerStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
headerStyle} -> Maybe TableCellStyle
headerStyle) (\s :: TableOptions
s@TableOptions' {} Maybe TableCellStyle
a -> TableOptions
s {$sel:headerStyle:TableOptions' :: Maybe TableCellStyle
headerStyle = Maybe TableCellStyle
a} :: TableOptions)

-- | The orientation (vertical, horizontal) for a table.
tableOptions_orientation :: Lens.Lens' TableOptions (Prelude.Maybe TableOrientation)
tableOptions_orientation :: Lens' TableOptions (Maybe TableOrientation)
tableOptions_orientation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableOptions' {Maybe TableOrientation
orientation :: Maybe TableOrientation
$sel:orientation:TableOptions' :: TableOptions -> Maybe TableOrientation
orientation} -> Maybe TableOrientation
orientation) (\s :: TableOptions
s@TableOptions' {} Maybe TableOrientation
a -> TableOptions
s {$sel:orientation:TableOptions' :: Maybe TableOrientation
orientation = Maybe TableOrientation
a} :: TableOptions)

-- | The row alternate color options (widget status, row alternate colors)
-- for a table.
tableOptions_rowAlternateColorOptions :: Lens.Lens' TableOptions (Prelude.Maybe RowAlternateColorOptions)
tableOptions_rowAlternateColorOptions :: Lens' TableOptions (Maybe RowAlternateColorOptions)
tableOptions_rowAlternateColorOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableOptions' {Maybe RowAlternateColorOptions
rowAlternateColorOptions :: Maybe RowAlternateColorOptions
$sel:rowAlternateColorOptions:TableOptions' :: TableOptions -> Maybe RowAlternateColorOptions
rowAlternateColorOptions} -> Maybe RowAlternateColorOptions
rowAlternateColorOptions) (\s :: TableOptions
s@TableOptions' {} Maybe RowAlternateColorOptions
a -> TableOptions
s {$sel:rowAlternateColorOptions:TableOptions' :: Maybe RowAlternateColorOptions
rowAlternateColorOptions = Maybe RowAlternateColorOptions
a} :: TableOptions)

instance Data.FromJSON TableOptions where
  parseJSON :: Value -> Parser TableOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableOptions"
      ( \Object
x ->
          Maybe TableCellStyle
-> Maybe TableCellStyle
-> Maybe TableOrientation
-> Maybe RowAlternateColorOptions
-> TableOptions
TableOptions'
            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
"CellStyle")
            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
"HeaderStyle")
            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
"Orientation")
            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
"RowAlternateColorOptions")
      )

instance Prelude.Hashable TableOptions where
  hashWithSalt :: Int -> TableOptions -> Int
hashWithSalt Int
_salt TableOptions' {Maybe TableOrientation
Maybe TableCellStyle
Maybe RowAlternateColorOptions
rowAlternateColorOptions :: Maybe RowAlternateColorOptions
orientation :: Maybe TableOrientation
headerStyle :: Maybe TableCellStyle
cellStyle :: Maybe TableCellStyle
$sel:rowAlternateColorOptions:TableOptions' :: TableOptions -> Maybe RowAlternateColorOptions
$sel:orientation:TableOptions' :: TableOptions -> Maybe TableOrientation
$sel:headerStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
$sel:cellStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableCellStyle
cellStyle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableCellStyle
headerStyle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableOrientation
orientation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RowAlternateColorOptions
rowAlternateColorOptions

instance Prelude.NFData TableOptions where
  rnf :: TableOptions -> ()
rnf TableOptions' {Maybe TableOrientation
Maybe TableCellStyle
Maybe RowAlternateColorOptions
rowAlternateColorOptions :: Maybe RowAlternateColorOptions
orientation :: Maybe TableOrientation
headerStyle :: Maybe TableCellStyle
cellStyle :: Maybe TableCellStyle
$sel:rowAlternateColorOptions:TableOptions' :: TableOptions -> Maybe RowAlternateColorOptions
$sel:orientation:TableOptions' :: TableOptions -> Maybe TableOrientation
$sel:headerStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
$sel:cellStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TableCellStyle
cellStyle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableCellStyle
headerStyle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableOrientation
orientation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RowAlternateColorOptions
rowAlternateColorOptions

instance Data.ToJSON TableOptions where
  toJSON :: TableOptions -> Value
toJSON TableOptions' {Maybe TableOrientation
Maybe TableCellStyle
Maybe RowAlternateColorOptions
rowAlternateColorOptions :: Maybe RowAlternateColorOptions
orientation :: Maybe TableOrientation
headerStyle :: Maybe TableCellStyle
cellStyle :: Maybe TableCellStyle
$sel:rowAlternateColorOptions:TableOptions' :: TableOptions -> Maybe RowAlternateColorOptions
$sel:orientation:TableOptions' :: TableOptions -> Maybe TableOrientation
$sel:headerStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
$sel:cellStyle:TableOptions' :: TableOptions -> Maybe TableCellStyle
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CellStyle" 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 TableCellStyle
cellStyle,
            (Key
"HeaderStyle" 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 TableCellStyle
headerStyle,
            (Key
"Orientation" 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 TableOrientation
orientation,
            (Key
"RowAlternateColorOptions" 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 RowAlternateColorOptions
rowAlternateColorOptions
          ]
      )