{-# 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.TableBorderOptions
-- 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.TableBorderOptions 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.TableBorderStyle

-- | The border options for a table border.
--
-- /See:/ 'newTableBorderOptions' smart constructor.
data TableBorderOptions = TableBorderOptions'
  { -- | The color of a table border.
    TableBorderOptions -> Maybe Text
color :: Prelude.Maybe Prelude.Text,
    -- | The style (none, solid) of a table border.
    TableBorderOptions -> Maybe TableBorderStyle
style :: Prelude.Maybe TableBorderStyle,
    -- | The thickness of a table border.
    TableBorderOptions -> Maybe Natural
thickness :: Prelude.Maybe Prelude.Natural
  }
  deriving (TableBorderOptions -> TableBorderOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableBorderOptions -> TableBorderOptions -> Bool
$c/= :: TableBorderOptions -> TableBorderOptions -> Bool
== :: TableBorderOptions -> TableBorderOptions -> Bool
$c== :: TableBorderOptions -> TableBorderOptions -> Bool
Prelude.Eq, ReadPrec [TableBorderOptions]
ReadPrec TableBorderOptions
Int -> ReadS TableBorderOptions
ReadS [TableBorderOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableBorderOptions]
$creadListPrec :: ReadPrec [TableBorderOptions]
readPrec :: ReadPrec TableBorderOptions
$creadPrec :: ReadPrec TableBorderOptions
readList :: ReadS [TableBorderOptions]
$creadList :: ReadS [TableBorderOptions]
readsPrec :: Int -> ReadS TableBorderOptions
$creadsPrec :: Int -> ReadS TableBorderOptions
Prelude.Read, Int -> TableBorderOptions -> ShowS
[TableBorderOptions] -> ShowS
TableBorderOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableBorderOptions] -> ShowS
$cshowList :: [TableBorderOptions] -> ShowS
show :: TableBorderOptions -> String
$cshow :: TableBorderOptions -> String
showsPrec :: Int -> TableBorderOptions -> ShowS
$cshowsPrec :: Int -> TableBorderOptions -> ShowS
Prelude.Show, forall x. Rep TableBorderOptions x -> TableBorderOptions
forall x. TableBorderOptions -> Rep TableBorderOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableBorderOptions x -> TableBorderOptions
$cfrom :: forall x. TableBorderOptions -> Rep TableBorderOptions x
Prelude.Generic)

-- |
-- Create a value of 'TableBorderOptions' 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:
--
-- 'color', 'tableBorderOptions_color' - The color of a table border.
--
-- 'style', 'tableBorderOptions_style' - The style (none, solid) of a table border.
--
-- 'thickness', 'tableBorderOptions_thickness' - The thickness of a table border.
newTableBorderOptions ::
  TableBorderOptions
newTableBorderOptions :: TableBorderOptions
newTableBorderOptions =
  TableBorderOptions'
    { $sel:color:TableBorderOptions' :: Maybe Text
color = forall a. Maybe a
Prelude.Nothing,
      $sel:style:TableBorderOptions' :: Maybe TableBorderStyle
style = forall a. Maybe a
Prelude.Nothing,
      $sel:thickness:TableBorderOptions' :: Maybe Natural
thickness = forall a. Maybe a
Prelude.Nothing
    }

-- | The color of a table border.
tableBorderOptions_color :: Lens.Lens' TableBorderOptions (Prelude.Maybe Prelude.Text)
tableBorderOptions_color :: Lens' TableBorderOptions (Maybe Text)
tableBorderOptions_color = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableBorderOptions' {Maybe Text
color :: Maybe Text
$sel:color:TableBorderOptions' :: TableBorderOptions -> Maybe Text
color} -> Maybe Text
color) (\s :: TableBorderOptions
s@TableBorderOptions' {} Maybe Text
a -> TableBorderOptions
s {$sel:color:TableBorderOptions' :: Maybe Text
color = Maybe Text
a} :: TableBorderOptions)

-- | The style (none, solid) of a table border.
tableBorderOptions_style :: Lens.Lens' TableBorderOptions (Prelude.Maybe TableBorderStyle)
tableBorderOptions_style :: Lens' TableBorderOptions (Maybe TableBorderStyle)
tableBorderOptions_style = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableBorderOptions' {Maybe TableBorderStyle
style :: Maybe TableBorderStyle
$sel:style:TableBorderOptions' :: TableBorderOptions -> Maybe TableBorderStyle
style} -> Maybe TableBorderStyle
style) (\s :: TableBorderOptions
s@TableBorderOptions' {} Maybe TableBorderStyle
a -> TableBorderOptions
s {$sel:style:TableBorderOptions' :: Maybe TableBorderStyle
style = Maybe TableBorderStyle
a} :: TableBorderOptions)

-- | The thickness of a table border.
tableBorderOptions_thickness :: Lens.Lens' TableBorderOptions (Prelude.Maybe Prelude.Natural)
tableBorderOptions_thickness :: Lens' TableBorderOptions (Maybe Natural)
tableBorderOptions_thickness = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableBorderOptions' {Maybe Natural
thickness :: Maybe Natural
$sel:thickness:TableBorderOptions' :: TableBorderOptions -> Maybe Natural
thickness} -> Maybe Natural
thickness) (\s :: TableBorderOptions
s@TableBorderOptions' {} Maybe Natural
a -> TableBorderOptions
s {$sel:thickness:TableBorderOptions' :: Maybe Natural
thickness = Maybe Natural
a} :: TableBorderOptions)

instance Data.FromJSON TableBorderOptions where
  parseJSON :: Value -> Parser TableBorderOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableBorderOptions"
      ( \Object
x ->
          Maybe Text
-> Maybe TableBorderStyle -> Maybe Natural -> TableBorderOptions
TableBorderOptions'
            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
"Color")
            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
"Style")
            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
"Thickness")
      )

instance Prelude.Hashable TableBorderOptions where
  hashWithSalt :: Int -> TableBorderOptions -> Int
hashWithSalt Int
_salt TableBorderOptions' {Maybe Natural
Maybe Text
Maybe TableBorderStyle
thickness :: Maybe Natural
style :: Maybe TableBorderStyle
color :: Maybe Text
$sel:thickness:TableBorderOptions' :: TableBorderOptions -> Maybe Natural
$sel:style:TableBorderOptions' :: TableBorderOptions -> Maybe TableBorderStyle
$sel:color:TableBorderOptions' :: TableBorderOptions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
color
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableBorderStyle
style
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
thickness

instance Prelude.NFData TableBorderOptions where
  rnf :: TableBorderOptions -> ()
rnf TableBorderOptions' {Maybe Natural
Maybe Text
Maybe TableBorderStyle
thickness :: Maybe Natural
style :: Maybe TableBorderStyle
color :: Maybe Text
$sel:thickness:TableBorderOptions' :: TableBorderOptions -> Maybe Natural
$sel:style:TableBorderOptions' :: TableBorderOptions -> Maybe TableBorderStyle
$sel:color:TableBorderOptions' :: TableBorderOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
color
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableBorderStyle
style
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
thickness

instance Data.ToJSON TableBorderOptions where
  toJSON :: TableBorderOptions -> Value
toJSON TableBorderOptions' {Maybe Natural
Maybe Text
Maybe TableBorderStyle
thickness :: Maybe Natural
style :: Maybe TableBorderStyle
color :: Maybe Text
$sel:thickness:TableBorderOptions' :: TableBorderOptions -> Maybe Natural
$sel:style:TableBorderOptions' :: TableBorderOptions -> Maybe TableBorderStyle
$sel:color:TableBorderOptions' :: TableBorderOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Color" 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
color,
            (Key
"Style" 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 TableBorderStyle
style,
            (Key
"Thickness" 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 Natural
thickness
          ]
      )