{-# 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.WaterfallChartOptions
-- 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.WaterfallChartOptions 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

-- | The options that determine the presentation of a waterfall visual.
--
-- /See:/ 'newWaterfallChartOptions' smart constructor.
data WaterfallChartOptions = WaterfallChartOptions'
  { -- | This option determines the total bar label of a waterfall visual.
    WaterfallChartOptions -> Maybe Text
totalBarLabel :: Prelude.Maybe Prelude.Text
  }
  deriving (WaterfallChartOptions -> WaterfallChartOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WaterfallChartOptions -> WaterfallChartOptions -> Bool
$c/= :: WaterfallChartOptions -> WaterfallChartOptions -> Bool
== :: WaterfallChartOptions -> WaterfallChartOptions -> Bool
$c== :: WaterfallChartOptions -> WaterfallChartOptions -> Bool
Prelude.Eq, ReadPrec [WaterfallChartOptions]
ReadPrec WaterfallChartOptions
Int -> ReadS WaterfallChartOptions
ReadS [WaterfallChartOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WaterfallChartOptions]
$creadListPrec :: ReadPrec [WaterfallChartOptions]
readPrec :: ReadPrec WaterfallChartOptions
$creadPrec :: ReadPrec WaterfallChartOptions
readList :: ReadS [WaterfallChartOptions]
$creadList :: ReadS [WaterfallChartOptions]
readsPrec :: Int -> ReadS WaterfallChartOptions
$creadsPrec :: Int -> ReadS WaterfallChartOptions
Prelude.Read, Int -> WaterfallChartOptions -> ShowS
[WaterfallChartOptions] -> ShowS
WaterfallChartOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WaterfallChartOptions] -> ShowS
$cshowList :: [WaterfallChartOptions] -> ShowS
show :: WaterfallChartOptions -> String
$cshow :: WaterfallChartOptions -> String
showsPrec :: Int -> WaterfallChartOptions -> ShowS
$cshowsPrec :: Int -> WaterfallChartOptions -> ShowS
Prelude.Show, forall x. Rep WaterfallChartOptions x -> WaterfallChartOptions
forall x. WaterfallChartOptions -> Rep WaterfallChartOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WaterfallChartOptions x -> WaterfallChartOptions
$cfrom :: forall x. WaterfallChartOptions -> Rep WaterfallChartOptions x
Prelude.Generic)

-- |
-- Create a value of 'WaterfallChartOptions' 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:
--
-- 'totalBarLabel', 'waterfallChartOptions_totalBarLabel' - This option determines the total bar label of a waterfall visual.
newWaterfallChartOptions ::
  WaterfallChartOptions
newWaterfallChartOptions :: WaterfallChartOptions
newWaterfallChartOptions =
  WaterfallChartOptions'
    { $sel:totalBarLabel:WaterfallChartOptions' :: Maybe Text
totalBarLabel =
        forall a. Maybe a
Prelude.Nothing
    }

-- | This option determines the total bar label of a waterfall visual.
waterfallChartOptions_totalBarLabel :: Lens.Lens' WaterfallChartOptions (Prelude.Maybe Prelude.Text)
waterfallChartOptions_totalBarLabel :: Lens' WaterfallChartOptions (Maybe Text)
waterfallChartOptions_totalBarLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WaterfallChartOptions' {Maybe Text
totalBarLabel :: Maybe Text
$sel:totalBarLabel:WaterfallChartOptions' :: WaterfallChartOptions -> Maybe Text
totalBarLabel} -> Maybe Text
totalBarLabel) (\s :: WaterfallChartOptions
s@WaterfallChartOptions' {} Maybe Text
a -> WaterfallChartOptions
s {$sel:totalBarLabel:WaterfallChartOptions' :: Maybe Text
totalBarLabel = Maybe Text
a} :: WaterfallChartOptions)

instance Data.FromJSON WaterfallChartOptions where
  parseJSON :: Value -> Parser WaterfallChartOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WaterfallChartOptions"
      ( \Object
x ->
          Maybe Text -> WaterfallChartOptions
WaterfallChartOptions'
            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
"TotalBarLabel")
      )

instance Prelude.Hashable WaterfallChartOptions where
  hashWithSalt :: Int -> WaterfallChartOptions -> Int
hashWithSalt Int
_salt WaterfallChartOptions' {Maybe Text
totalBarLabel :: Maybe Text
$sel:totalBarLabel:WaterfallChartOptions' :: WaterfallChartOptions -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
totalBarLabel

instance Prelude.NFData WaterfallChartOptions where
  rnf :: WaterfallChartOptions -> ()
rnf WaterfallChartOptions' {Maybe Text
totalBarLabel :: Maybe Text
$sel:totalBarLabel:WaterfallChartOptions' :: WaterfallChartOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
totalBarLabel

instance Data.ToJSON WaterfallChartOptions where
  toJSON :: WaterfallChartOptions -> Value
toJSON WaterfallChartOptions' {Maybe Text
totalBarLabel :: Maybe Text
$sel:totalBarLabel:WaterfallChartOptions' :: WaterfallChartOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"TotalBarLabel" 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
totalBarLabel
          ]
      )