{-# 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.DonutOptions
-- 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.DonutOptions 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.ArcOptions
import Amazonka.QuickSight.Types.DonutCenterOptions

-- | The options for configuring a donut chart or pie chart.
--
-- /See:/ 'newDonutOptions' smart constructor.
data DonutOptions = DonutOptions'
  { -- | The option for define the arc of the chart shape. Valid values are as
    -- follows:
    --
    -- -   @WHOLE@ - A pie chart
    --
    -- -   @SMALL@- A small-sized donut chart
    --
    -- -   @MEDIUM@- A medium-sized donut chart
    --
    -- -   @LARGE@- A large-sized donut chart
    DonutOptions -> Maybe ArcOptions
arcOptions :: Prelude.Maybe ArcOptions,
    -- | The label options of the label that is displayed in the center of a
    -- donut chart. This option isn\'t available for pie charts.
    DonutOptions -> Maybe DonutCenterOptions
donutCenterOptions :: Prelude.Maybe DonutCenterOptions
  }
  deriving (DonutOptions -> DonutOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DonutOptions -> DonutOptions -> Bool
$c/= :: DonutOptions -> DonutOptions -> Bool
== :: DonutOptions -> DonutOptions -> Bool
$c== :: DonutOptions -> DonutOptions -> Bool
Prelude.Eq, ReadPrec [DonutOptions]
ReadPrec DonutOptions
Int -> ReadS DonutOptions
ReadS [DonutOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DonutOptions]
$creadListPrec :: ReadPrec [DonutOptions]
readPrec :: ReadPrec DonutOptions
$creadPrec :: ReadPrec DonutOptions
readList :: ReadS [DonutOptions]
$creadList :: ReadS [DonutOptions]
readsPrec :: Int -> ReadS DonutOptions
$creadsPrec :: Int -> ReadS DonutOptions
Prelude.Read, Int -> DonutOptions -> ShowS
[DonutOptions] -> ShowS
DonutOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DonutOptions] -> ShowS
$cshowList :: [DonutOptions] -> ShowS
show :: DonutOptions -> String
$cshow :: DonutOptions -> String
showsPrec :: Int -> DonutOptions -> ShowS
$cshowsPrec :: Int -> DonutOptions -> ShowS
Prelude.Show, forall x. Rep DonutOptions x -> DonutOptions
forall x. DonutOptions -> Rep DonutOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DonutOptions x -> DonutOptions
$cfrom :: forall x. DonutOptions -> Rep DonutOptions x
Prelude.Generic)

-- |
-- Create a value of 'DonutOptions' 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:
--
-- 'arcOptions', 'donutOptions_arcOptions' - The option for define the arc of the chart shape. Valid values are as
-- follows:
--
-- -   @WHOLE@ - A pie chart
--
-- -   @SMALL@- A small-sized donut chart
--
-- -   @MEDIUM@- A medium-sized donut chart
--
-- -   @LARGE@- A large-sized donut chart
--
-- 'donutCenterOptions', 'donutOptions_donutCenterOptions' - The label options of the label that is displayed in the center of a
-- donut chart. This option isn\'t available for pie charts.
newDonutOptions ::
  DonutOptions
newDonutOptions :: DonutOptions
newDonutOptions =
  DonutOptions'
    { $sel:arcOptions:DonutOptions' :: Maybe ArcOptions
arcOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:donutCenterOptions:DonutOptions' :: Maybe DonutCenterOptions
donutCenterOptions = forall a. Maybe a
Prelude.Nothing
    }

-- | The option for define the arc of the chart shape. Valid values are as
-- follows:
--
-- -   @WHOLE@ - A pie chart
--
-- -   @SMALL@- A small-sized donut chart
--
-- -   @MEDIUM@- A medium-sized donut chart
--
-- -   @LARGE@- A large-sized donut chart
donutOptions_arcOptions :: Lens.Lens' DonutOptions (Prelude.Maybe ArcOptions)
donutOptions_arcOptions :: Lens' DonutOptions (Maybe ArcOptions)
donutOptions_arcOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DonutOptions' {Maybe ArcOptions
arcOptions :: Maybe ArcOptions
$sel:arcOptions:DonutOptions' :: DonutOptions -> Maybe ArcOptions
arcOptions} -> Maybe ArcOptions
arcOptions) (\s :: DonutOptions
s@DonutOptions' {} Maybe ArcOptions
a -> DonutOptions
s {$sel:arcOptions:DonutOptions' :: Maybe ArcOptions
arcOptions = Maybe ArcOptions
a} :: DonutOptions)

-- | The label options of the label that is displayed in the center of a
-- donut chart. This option isn\'t available for pie charts.
donutOptions_donutCenterOptions :: Lens.Lens' DonutOptions (Prelude.Maybe DonutCenterOptions)
donutOptions_donutCenterOptions :: Lens' DonutOptions (Maybe DonutCenterOptions)
donutOptions_donutCenterOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DonutOptions' {Maybe DonutCenterOptions
donutCenterOptions :: Maybe DonutCenterOptions
$sel:donutCenterOptions:DonutOptions' :: DonutOptions -> Maybe DonutCenterOptions
donutCenterOptions} -> Maybe DonutCenterOptions
donutCenterOptions) (\s :: DonutOptions
s@DonutOptions' {} Maybe DonutCenterOptions
a -> DonutOptions
s {$sel:donutCenterOptions:DonutOptions' :: Maybe DonutCenterOptions
donutCenterOptions = Maybe DonutCenterOptions
a} :: DonutOptions)

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

instance Prelude.Hashable DonutOptions where
  hashWithSalt :: Int -> DonutOptions -> Int
hashWithSalt Int
_salt DonutOptions' {Maybe ArcOptions
Maybe DonutCenterOptions
donutCenterOptions :: Maybe DonutCenterOptions
arcOptions :: Maybe ArcOptions
$sel:donutCenterOptions:DonutOptions' :: DonutOptions -> Maybe DonutCenterOptions
$sel:arcOptions:DonutOptions' :: DonutOptions -> Maybe ArcOptions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ArcOptions
arcOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DonutCenterOptions
donutCenterOptions

instance Prelude.NFData DonutOptions where
  rnf :: DonutOptions -> ()
rnf DonutOptions' {Maybe ArcOptions
Maybe DonutCenterOptions
donutCenterOptions :: Maybe DonutCenterOptions
arcOptions :: Maybe ArcOptions
$sel:donutCenterOptions:DonutOptions' :: DonutOptions -> Maybe DonutCenterOptions
$sel:arcOptions:DonutOptions' :: DonutOptions -> Maybe ArcOptions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ArcOptions
arcOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DonutCenterOptions
donutCenterOptions

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