{-# 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.SecondaryValueOptions
-- 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.SecondaryValueOptions 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 options that determine the presentation of the secondary value of a
-- KPI visual.
--
-- /See:/ 'newSecondaryValueOptions' smart constructor.
data SecondaryValueOptions = SecondaryValueOptions'
  { -- | Determines the visibility of the secondary value.
    SecondaryValueOptions -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (SecondaryValueOptions -> SecondaryValueOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecondaryValueOptions -> SecondaryValueOptions -> Bool
$c/= :: SecondaryValueOptions -> SecondaryValueOptions -> Bool
== :: SecondaryValueOptions -> SecondaryValueOptions -> Bool
$c== :: SecondaryValueOptions -> SecondaryValueOptions -> Bool
Prelude.Eq, ReadPrec [SecondaryValueOptions]
ReadPrec SecondaryValueOptions
Int -> ReadS SecondaryValueOptions
ReadS [SecondaryValueOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecondaryValueOptions]
$creadListPrec :: ReadPrec [SecondaryValueOptions]
readPrec :: ReadPrec SecondaryValueOptions
$creadPrec :: ReadPrec SecondaryValueOptions
readList :: ReadS [SecondaryValueOptions]
$creadList :: ReadS [SecondaryValueOptions]
readsPrec :: Int -> ReadS SecondaryValueOptions
$creadsPrec :: Int -> ReadS SecondaryValueOptions
Prelude.Read, Int -> SecondaryValueOptions -> ShowS
[SecondaryValueOptions] -> ShowS
SecondaryValueOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecondaryValueOptions] -> ShowS
$cshowList :: [SecondaryValueOptions] -> ShowS
show :: SecondaryValueOptions -> String
$cshow :: SecondaryValueOptions -> String
showsPrec :: Int -> SecondaryValueOptions -> ShowS
$cshowsPrec :: Int -> SecondaryValueOptions -> ShowS
Prelude.Show, forall x. Rep SecondaryValueOptions x -> SecondaryValueOptions
forall x. SecondaryValueOptions -> Rep SecondaryValueOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecondaryValueOptions x -> SecondaryValueOptions
$cfrom :: forall x. SecondaryValueOptions -> Rep SecondaryValueOptions x
Prelude.Generic)

-- |
-- Create a value of 'SecondaryValueOptions' 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:
--
-- 'visibility', 'secondaryValueOptions_visibility' - Determines the visibility of the secondary value.
newSecondaryValueOptions ::
  SecondaryValueOptions
newSecondaryValueOptions :: SecondaryValueOptions
newSecondaryValueOptions =
  SecondaryValueOptions'
    { $sel:visibility:SecondaryValueOptions' :: Maybe Visibility
visibility =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Determines the visibility of the secondary value.
secondaryValueOptions_visibility :: Lens.Lens' SecondaryValueOptions (Prelude.Maybe Visibility)
secondaryValueOptions_visibility :: Lens' SecondaryValueOptions (Maybe Visibility)
secondaryValueOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecondaryValueOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:SecondaryValueOptions' :: SecondaryValueOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: SecondaryValueOptions
s@SecondaryValueOptions' {} Maybe Visibility
a -> SecondaryValueOptions
s {$sel:visibility:SecondaryValueOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: SecondaryValueOptions)

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

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

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

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