{-# 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.TotalOptions
-- 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.TotalOptions 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.TableCellStyle
import Amazonka.QuickSight.Types.TableTotalsPlacement
import Amazonka.QuickSight.Types.TableTotalsScrollStatus
import Amazonka.QuickSight.Types.Visibility

-- | The total options for a table visual.
--
-- /See:/ 'newTotalOptions' smart constructor.
data TotalOptions = TotalOptions'
  { -- | The custom label string for the total cells.
    TotalOptions -> Maybe Text
customLabel :: Prelude.Maybe Prelude.Text,
    -- | The placement (start, end) for the total cells.
    TotalOptions -> Maybe TableTotalsPlacement
placement :: Prelude.Maybe TableTotalsPlacement,
    -- | The scroll status (pinned, scrolled) for the total cells.
    TotalOptions -> Maybe TableTotalsScrollStatus
scrollStatus :: Prelude.Maybe TableTotalsScrollStatus,
    -- | Cell styling options for the total cells.
    TotalOptions -> Maybe TableCellStyle
totalCellStyle :: Prelude.Maybe TableCellStyle,
    -- | The visibility configuration for the total cells.
    TotalOptions -> Maybe Visibility
totalsVisibility :: Prelude.Maybe Visibility
  }
  deriving (TotalOptions -> TotalOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TotalOptions -> TotalOptions -> Bool
$c/= :: TotalOptions -> TotalOptions -> Bool
== :: TotalOptions -> TotalOptions -> Bool
$c== :: TotalOptions -> TotalOptions -> Bool
Prelude.Eq, ReadPrec [TotalOptions]
ReadPrec TotalOptions
Int -> ReadS TotalOptions
ReadS [TotalOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TotalOptions]
$creadListPrec :: ReadPrec [TotalOptions]
readPrec :: ReadPrec TotalOptions
$creadPrec :: ReadPrec TotalOptions
readList :: ReadS [TotalOptions]
$creadList :: ReadS [TotalOptions]
readsPrec :: Int -> ReadS TotalOptions
$creadsPrec :: Int -> ReadS TotalOptions
Prelude.Read, Int -> TotalOptions -> ShowS
[TotalOptions] -> ShowS
TotalOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TotalOptions] -> ShowS
$cshowList :: [TotalOptions] -> ShowS
show :: TotalOptions -> String
$cshow :: TotalOptions -> String
showsPrec :: Int -> TotalOptions -> ShowS
$cshowsPrec :: Int -> TotalOptions -> ShowS
Prelude.Show, forall x. Rep TotalOptions x -> TotalOptions
forall x. TotalOptions -> Rep TotalOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TotalOptions x -> TotalOptions
$cfrom :: forall x. TotalOptions -> Rep TotalOptions x
Prelude.Generic)

-- |
-- Create a value of 'TotalOptions' 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:
--
-- 'customLabel', 'totalOptions_customLabel' - The custom label string for the total cells.
--
-- 'placement', 'totalOptions_placement' - The placement (start, end) for the total cells.
--
-- 'scrollStatus', 'totalOptions_scrollStatus' - The scroll status (pinned, scrolled) for the total cells.
--
-- 'totalCellStyle', 'totalOptions_totalCellStyle' - Cell styling options for the total cells.
--
-- 'totalsVisibility', 'totalOptions_totalsVisibility' - The visibility configuration for the total cells.
newTotalOptions ::
  TotalOptions
newTotalOptions :: TotalOptions
newTotalOptions =
  TotalOptions'
    { $sel:customLabel:TotalOptions' :: Maybe Text
customLabel = forall a. Maybe a
Prelude.Nothing,
      $sel:placement:TotalOptions' :: Maybe TableTotalsPlacement
placement = forall a. Maybe a
Prelude.Nothing,
      $sel:scrollStatus:TotalOptions' :: Maybe TableTotalsScrollStatus
scrollStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCellStyle:TotalOptions' :: Maybe TableCellStyle
totalCellStyle = forall a. Maybe a
Prelude.Nothing,
      $sel:totalsVisibility:TotalOptions' :: Maybe Visibility
totalsVisibility = forall a. Maybe a
Prelude.Nothing
    }

-- | The custom label string for the total cells.
totalOptions_customLabel :: Lens.Lens' TotalOptions (Prelude.Maybe Prelude.Text)
totalOptions_customLabel :: Lens' TotalOptions (Maybe Text)
totalOptions_customLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalOptions' {Maybe Text
customLabel :: Maybe Text
$sel:customLabel:TotalOptions' :: TotalOptions -> Maybe Text
customLabel} -> Maybe Text
customLabel) (\s :: TotalOptions
s@TotalOptions' {} Maybe Text
a -> TotalOptions
s {$sel:customLabel:TotalOptions' :: Maybe Text
customLabel = Maybe Text
a} :: TotalOptions)

-- | The placement (start, end) for the total cells.
totalOptions_placement :: Lens.Lens' TotalOptions (Prelude.Maybe TableTotalsPlacement)
totalOptions_placement :: Lens' TotalOptions (Maybe TableTotalsPlacement)
totalOptions_placement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalOptions' {Maybe TableTotalsPlacement
placement :: Maybe TableTotalsPlacement
$sel:placement:TotalOptions' :: TotalOptions -> Maybe TableTotalsPlacement
placement} -> Maybe TableTotalsPlacement
placement) (\s :: TotalOptions
s@TotalOptions' {} Maybe TableTotalsPlacement
a -> TotalOptions
s {$sel:placement:TotalOptions' :: Maybe TableTotalsPlacement
placement = Maybe TableTotalsPlacement
a} :: TotalOptions)

-- | The scroll status (pinned, scrolled) for the total cells.
totalOptions_scrollStatus :: Lens.Lens' TotalOptions (Prelude.Maybe TableTotalsScrollStatus)
totalOptions_scrollStatus :: Lens' TotalOptions (Maybe TableTotalsScrollStatus)
totalOptions_scrollStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalOptions' {Maybe TableTotalsScrollStatus
scrollStatus :: Maybe TableTotalsScrollStatus
$sel:scrollStatus:TotalOptions' :: TotalOptions -> Maybe TableTotalsScrollStatus
scrollStatus} -> Maybe TableTotalsScrollStatus
scrollStatus) (\s :: TotalOptions
s@TotalOptions' {} Maybe TableTotalsScrollStatus
a -> TotalOptions
s {$sel:scrollStatus:TotalOptions' :: Maybe TableTotalsScrollStatus
scrollStatus = Maybe TableTotalsScrollStatus
a} :: TotalOptions)

-- | Cell styling options for the total cells.
totalOptions_totalCellStyle :: Lens.Lens' TotalOptions (Prelude.Maybe TableCellStyle)
totalOptions_totalCellStyle :: Lens' TotalOptions (Maybe TableCellStyle)
totalOptions_totalCellStyle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalOptions' {Maybe TableCellStyle
totalCellStyle :: Maybe TableCellStyle
$sel:totalCellStyle:TotalOptions' :: TotalOptions -> Maybe TableCellStyle
totalCellStyle} -> Maybe TableCellStyle
totalCellStyle) (\s :: TotalOptions
s@TotalOptions' {} Maybe TableCellStyle
a -> TotalOptions
s {$sel:totalCellStyle:TotalOptions' :: Maybe TableCellStyle
totalCellStyle = Maybe TableCellStyle
a} :: TotalOptions)

-- | The visibility configuration for the total cells.
totalOptions_totalsVisibility :: Lens.Lens' TotalOptions (Prelude.Maybe Visibility)
totalOptions_totalsVisibility :: Lens' TotalOptions (Maybe Visibility)
totalOptions_totalsVisibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalOptions' {Maybe Visibility
totalsVisibility :: Maybe Visibility
$sel:totalsVisibility:TotalOptions' :: TotalOptions -> Maybe Visibility
totalsVisibility} -> Maybe Visibility
totalsVisibility) (\s :: TotalOptions
s@TotalOptions' {} Maybe Visibility
a -> TotalOptions
s {$sel:totalsVisibility:TotalOptions' :: Maybe Visibility
totalsVisibility = Maybe Visibility
a} :: TotalOptions)

instance Data.FromJSON TotalOptions where
  parseJSON :: Value -> Parser TotalOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TotalOptions"
      ( \Object
x ->
          Maybe Text
-> Maybe TableTotalsPlacement
-> Maybe TableTotalsScrollStatus
-> Maybe TableCellStyle
-> Maybe Visibility
-> TotalOptions
TotalOptions'
            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
"CustomLabel")
            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
"Placement")
            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
"ScrollStatus")
            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
"TotalCellStyle")
            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
"TotalsVisibility")
      )

instance Prelude.Hashable TotalOptions where
  hashWithSalt :: Int -> TotalOptions -> Int
hashWithSalt Int
_salt TotalOptions' {Maybe Text
Maybe TableTotalsPlacement
Maybe TableTotalsScrollStatus
Maybe Visibility
Maybe TableCellStyle
totalsVisibility :: Maybe Visibility
totalCellStyle :: Maybe TableCellStyle
scrollStatus :: Maybe TableTotalsScrollStatus
placement :: Maybe TableTotalsPlacement
customLabel :: Maybe Text
$sel:totalsVisibility:TotalOptions' :: TotalOptions -> Maybe Visibility
$sel:totalCellStyle:TotalOptions' :: TotalOptions -> Maybe TableCellStyle
$sel:scrollStatus:TotalOptions' :: TotalOptions -> Maybe TableTotalsScrollStatus
$sel:placement:TotalOptions' :: TotalOptions -> Maybe TableTotalsPlacement
$sel:customLabel:TotalOptions' :: TotalOptions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customLabel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableTotalsPlacement
placement
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableTotalsScrollStatus
scrollStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableCellStyle
totalCellStyle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
totalsVisibility

instance Prelude.NFData TotalOptions where
  rnf :: TotalOptions -> ()
rnf TotalOptions' {Maybe Text
Maybe TableTotalsPlacement
Maybe TableTotalsScrollStatus
Maybe Visibility
Maybe TableCellStyle
totalsVisibility :: Maybe Visibility
totalCellStyle :: Maybe TableCellStyle
scrollStatus :: Maybe TableTotalsScrollStatus
placement :: Maybe TableTotalsPlacement
customLabel :: Maybe Text
$sel:totalsVisibility:TotalOptions' :: TotalOptions -> Maybe Visibility
$sel:totalCellStyle:TotalOptions' :: TotalOptions -> Maybe TableCellStyle
$sel:scrollStatus:TotalOptions' :: TotalOptions -> Maybe TableTotalsScrollStatus
$sel:placement:TotalOptions' :: TotalOptions -> Maybe TableTotalsPlacement
$sel:customLabel:TotalOptions' :: TotalOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customLabel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableTotalsPlacement
placement
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableTotalsScrollStatus
scrollStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableCellStyle
totalCellStyle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
totalsVisibility

instance Data.ToJSON TotalOptions where
  toJSON :: TotalOptions -> Value
toJSON TotalOptions' {Maybe Text
Maybe TableTotalsPlacement
Maybe TableTotalsScrollStatus
Maybe Visibility
Maybe TableCellStyle
totalsVisibility :: Maybe Visibility
totalCellStyle :: Maybe TableCellStyle
scrollStatus :: Maybe TableTotalsScrollStatus
placement :: Maybe TableTotalsPlacement
customLabel :: Maybe Text
$sel:totalsVisibility:TotalOptions' :: TotalOptions -> Maybe Visibility
$sel:totalCellStyle:TotalOptions' :: TotalOptions -> Maybe TableCellStyle
$sel:scrollStatus:TotalOptions' :: TotalOptions -> Maybe TableTotalsScrollStatus
$sel:placement:TotalOptions' :: TotalOptions -> Maybe TableTotalsPlacement
$sel:customLabel:TotalOptions' :: TotalOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CustomLabel" 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
customLabel,
            (Key
"Placement" 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 TableTotalsPlacement
placement,
            (Key
"ScrollStatus" 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 TableTotalsScrollStatus
scrollStatus,
            (Key
"TotalCellStyle" 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
totalCellStyle,
            (Key
"TotalsVisibility" 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 Visibility
totalsVisibility
          ]
      )