{-# 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.DonutCenterOptions
-- 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.DonutCenterOptions 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.Visibility

-- | The label options of the label that is displayed in the center of a
-- donut chart. This option isn\'t available for pie charts.
--
-- /See:/ 'newDonutCenterOptions' smart constructor.
data DonutCenterOptions = DonutCenterOptions'
  { -- | Determines the visibility of the label in a donut chart. In the Amazon
    -- QuickSight console, this option is called @\'Show total\'@.
    DonutCenterOptions -> Maybe Visibility
labelVisibility :: Prelude.Maybe Visibility
  }
  deriving (DonutCenterOptions -> DonutCenterOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DonutCenterOptions -> DonutCenterOptions -> Bool
$c/= :: DonutCenterOptions -> DonutCenterOptions -> Bool
== :: DonutCenterOptions -> DonutCenterOptions -> Bool
$c== :: DonutCenterOptions -> DonutCenterOptions -> Bool
Prelude.Eq, ReadPrec [DonutCenterOptions]
ReadPrec DonutCenterOptions
Int -> ReadS DonutCenterOptions
ReadS [DonutCenterOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DonutCenterOptions]
$creadListPrec :: ReadPrec [DonutCenterOptions]
readPrec :: ReadPrec DonutCenterOptions
$creadPrec :: ReadPrec DonutCenterOptions
readList :: ReadS [DonutCenterOptions]
$creadList :: ReadS [DonutCenterOptions]
readsPrec :: Int -> ReadS DonutCenterOptions
$creadsPrec :: Int -> ReadS DonutCenterOptions
Prelude.Read, Int -> DonutCenterOptions -> ShowS
[DonutCenterOptions] -> ShowS
DonutCenterOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DonutCenterOptions] -> ShowS
$cshowList :: [DonutCenterOptions] -> ShowS
show :: DonutCenterOptions -> String
$cshow :: DonutCenterOptions -> String
showsPrec :: Int -> DonutCenterOptions -> ShowS
$cshowsPrec :: Int -> DonutCenterOptions -> ShowS
Prelude.Show, forall x. Rep DonutCenterOptions x -> DonutCenterOptions
forall x. DonutCenterOptions -> Rep DonutCenterOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DonutCenterOptions x -> DonutCenterOptions
$cfrom :: forall x. DonutCenterOptions -> Rep DonutCenterOptions x
Prelude.Generic)

-- |
-- Create a value of 'DonutCenterOptions' 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:
--
-- 'labelVisibility', 'donutCenterOptions_labelVisibility' - Determines the visibility of the label in a donut chart. In the Amazon
-- QuickSight console, this option is called @\'Show total\'@.
newDonutCenterOptions ::
  DonutCenterOptions
newDonutCenterOptions :: DonutCenterOptions
newDonutCenterOptions =
  DonutCenterOptions'
    { $sel:labelVisibility:DonutCenterOptions' :: Maybe Visibility
labelVisibility =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Determines the visibility of the label in a donut chart. In the Amazon
-- QuickSight console, this option is called @\'Show total\'@.
donutCenterOptions_labelVisibility :: Lens.Lens' DonutCenterOptions (Prelude.Maybe Visibility)
donutCenterOptions_labelVisibility :: Lens' DonutCenterOptions (Maybe Visibility)
donutCenterOptions_labelVisibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DonutCenterOptions' {Maybe Visibility
labelVisibility :: Maybe Visibility
$sel:labelVisibility:DonutCenterOptions' :: DonutCenterOptions -> Maybe Visibility
labelVisibility} -> Maybe Visibility
labelVisibility) (\s :: DonutCenterOptions
s@DonutCenterOptions' {} Maybe Visibility
a -> DonutCenterOptions
s {$sel:labelVisibility:DonutCenterOptions' :: Maybe Visibility
labelVisibility = Maybe Visibility
a} :: DonutCenterOptions)

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

instance Prelude.Hashable DonutCenterOptions where
  hashWithSalt :: Int -> DonutCenterOptions -> Int
hashWithSalt Int
_salt DonutCenterOptions' {Maybe Visibility
labelVisibility :: Maybe Visibility
$sel:labelVisibility:DonutCenterOptions' :: DonutCenterOptions -> Maybe Visibility
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
labelVisibility

instance Prelude.NFData DonutCenterOptions where
  rnf :: DonutCenterOptions -> ()
rnf DonutCenterOptions' {Maybe Visibility
labelVisibility :: Maybe Visibility
$sel:labelVisibility:DonutCenterOptions' :: DonutCenterOptions -> Maybe Visibility
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
labelVisibility

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