{-# 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.GlobalTableBorderOptions
-- 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.GlobalTableBorderOptions 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.TableBorderOptions
import Amazonka.QuickSight.Types.TableSideBorderOptions

-- | Determines the border options for a table visual.
--
-- /See:/ 'newGlobalTableBorderOptions' smart constructor.
data GlobalTableBorderOptions = GlobalTableBorderOptions'
  { -- | Determines the options for side specific border.
    GlobalTableBorderOptions -> Maybe TableSideBorderOptions
sideSpecificBorder :: Prelude.Maybe TableSideBorderOptions,
    -- | Determines the options for uniform border.
    GlobalTableBorderOptions -> Maybe TableBorderOptions
uniformBorder :: Prelude.Maybe TableBorderOptions
  }
  deriving (GlobalTableBorderOptions -> GlobalTableBorderOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlobalTableBorderOptions -> GlobalTableBorderOptions -> Bool
$c/= :: GlobalTableBorderOptions -> GlobalTableBorderOptions -> Bool
== :: GlobalTableBorderOptions -> GlobalTableBorderOptions -> Bool
$c== :: GlobalTableBorderOptions -> GlobalTableBorderOptions -> Bool
Prelude.Eq, ReadPrec [GlobalTableBorderOptions]
ReadPrec GlobalTableBorderOptions
Int -> ReadS GlobalTableBorderOptions
ReadS [GlobalTableBorderOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GlobalTableBorderOptions]
$creadListPrec :: ReadPrec [GlobalTableBorderOptions]
readPrec :: ReadPrec GlobalTableBorderOptions
$creadPrec :: ReadPrec GlobalTableBorderOptions
readList :: ReadS [GlobalTableBorderOptions]
$creadList :: ReadS [GlobalTableBorderOptions]
readsPrec :: Int -> ReadS GlobalTableBorderOptions
$creadsPrec :: Int -> ReadS GlobalTableBorderOptions
Prelude.Read, Int -> GlobalTableBorderOptions -> ShowS
[GlobalTableBorderOptions] -> ShowS
GlobalTableBorderOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GlobalTableBorderOptions] -> ShowS
$cshowList :: [GlobalTableBorderOptions] -> ShowS
show :: GlobalTableBorderOptions -> String
$cshow :: GlobalTableBorderOptions -> String
showsPrec :: Int -> GlobalTableBorderOptions -> ShowS
$cshowsPrec :: Int -> GlobalTableBorderOptions -> ShowS
Prelude.Show, forall x.
Rep GlobalTableBorderOptions x -> GlobalTableBorderOptions
forall x.
GlobalTableBorderOptions -> Rep GlobalTableBorderOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GlobalTableBorderOptions x -> GlobalTableBorderOptions
$cfrom :: forall x.
GlobalTableBorderOptions -> Rep GlobalTableBorderOptions x
Prelude.Generic)

-- |
-- Create a value of 'GlobalTableBorderOptions' 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:
--
-- 'sideSpecificBorder', 'globalTableBorderOptions_sideSpecificBorder' - Determines the options for side specific border.
--
-- 'uniformBorder', 'globalTableBorderOptions_uniformBorder' - Determines the options for uniform border.
newGlobalTableBorderOptions ::
  GlobalTableBorderOptions
newGlobalTableBorderOptions :: GlobalTableBorderOptions
newGlobalTableBorderOptions =
  GlobalTableBorderOptions'
    { $sel:sideSpecificBorder:GlobalTableBorderOptions' :: Maybe TableSideBorderOptions
sideSpecificBorder =
        forall a. Maybe a
Prelude.Nothing,
      $sel:uniformBorder:GlobalTableBorderOptions' :: Maybe TableBorderOptions
uniformBorder = forall a. Maybe a
Prelude.Nothing
    }

-- | Determines the options for side specific border.
globalTableBorderOptions_sideSpecificBorder :: Lens.Lens' GlobalTableBorderOptions (Prelude.Maybe TableSideBorderOptions)
globalTableBorderOptions_sideSpecificBorder :: Lens' GlobalTableBorderOptions (Maybe TableSideBorderOptions)
globalTableBorderOptions_sideSpecificBorder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalTableBorderOptions' {Maybe TableSideBorderOptions
sideSpecificBorder :: Maybe TableSideBorderOptions
$sel:sideSpecificBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableSideBorderOptions
sideSpecificBorder} -> Maybe TableSideBorderOptions
sideSpecificBorder) (\s :: GlobalTableBorderOptions
s@GlobalTableBorderOptions' {} Maybe TableSideBorderOptions
a -> GlobalTableBorderOptions
s {$sel:sideSpecificBorder:GlobalTableBorderOptions' :: Maybe TableSideBorderOptions
sideSpecificBorder = Maybe TableSideBorderOptions
a} :: GlobalTableBorderOptions)

-- | Determines the options for uniform border.
globalTableBorderOptions_uniformBorder :: Lens.Lens' GlobalTableBorderOptions (Prelude.Maybe TableBorderOptions)
globalTableBorderOptions_uniformBorder :: Lens' GlobalTableBorderOptions (Maybe TableBorderOptions)
globalTableBorderOptions_uniformBorder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalTableBorderOptions' {Maybe TableBorderOptions
uniformBorder :: Maybe TableBorderOptions
$sel:uniformBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableBorderOptions
uniformBorder} -> Maybe TableBorderOptions
uniformBorder) (\s :: GlobalTableBorderOptions
s@GlobalTableBorderOptions' {} Maybe TableBorderOptions
a -> GlobalTableBorderOptions
s {$sel:uniformBorder:GlobalTableBorderOptions' :: Maybe TableBorderOptions
uniformBorder = Maybe TableBorderOptions
a} :: GlobalTableBorderOptions)

instance Data.FromJSON GlobalTableBorderOptions where
  parseJSON :: Value -> Parser GlobalTableBorderOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GlobalTableBorderOptions"
      ( \Object
x ->
          Maybe TableSideBorderOptions
-> Maybe TableBorderOptions -> GlobalTableBorderOptions
GlobalTableBorderOptions'
            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
"SideSpecificBorder")
            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
"UniformBorder")
      )

instance Prelude.Hashable GlobalTableBorderOptions where
  hashWithSalt :: Int -> GlobalTableBorderOptions -> Int
hashWithSalt Int
_salt GlobalTableBorderOptions' {Maybe TableBorderOptions
Maybe TableSideBorderOptions
uniformBorder :: Maybe TableBorderOptions
sideSpecificBorder :: Maybe TableSideBorderOptions
$sel:uniformBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableBorderOptions
$sel:sideSpecificBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableSideBorderOptions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableSideBorderOptions
sideSpecificBorder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableBorderOptions
uniformBorder

instance Prelude.NFData GlobalTableBorderOptions where
  rnf :: GlobalTableBorderOptions -> ()
rnf GlobalTableBorderOptions' {Maybe TableBorderOptions
Maybe TableSideBorderOptions
uniformBorder :: Maybe TableBorderOptions
sideSpecificBorder :: Maybe TableSideBorderOptions
$sel:uniformBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableBorderOptions
$sel:sideSpecificBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableSideBorderOptions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TableSideBorderOptions
sideSpecificBorder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableBorderOptions
uniformBorder

instance Data.ToJSON GlobalTableBorderOptions where
  toJSON :: GlobalTableBorderOptions -> Value
toJSON GlobalTableBorderOptions' {Maybe TableBorderOptions
Maybe TableSideBorderOptions
uniformBorder :: Maybe TableBorderOptions
sideSpecificBorder :: Maybe TableSideBorderOptions
$sel:uniformBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableBorderOptions
$sel:sideSpecificBorder:GlobalTableBorderOptions' :: GlobalTableBorderOptions -> Maybe TableSideBorderOptions
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SideSpecificBorder" 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 TableSideBorderOptions
sideSpecificBorder,
            (Key
"UniformBorder" 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 TableBorderOptions
uniformBorder
          ]
      )