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

-- |
-- Create a value of 'TrendArrowOptions' 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', 'trendArrowOptions_visibility' - The visibility of the trend arrows.
newTrendArrowOptions ::
  TrendArrowOptions
newTrendArrowOptions :: TrendArrowOptions
newTrendArrowOptions =
  TrendArrowOptions' {$sel:visibility:TrendArrowOptions' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing}

-- | The visibility of the trend arrows.
trendArrowOptions_visibility :: Lens.Lens' TrendArrowOptions (Prelude.Maybe Visibility)
trendArrowOptions_visibility :: Lens' TrendArrowOptions (Maybe Visibility)
trendArrowOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrendArrowOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:TrendArrowOptions' :: TrendArrowOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: TrendArrowOptions
s@TrendArrowOptions' {} Maybe Visibility
a -> TrendArrowOptions
s {$sel:visibility:TrendArrowOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: TrendArrowOptions)

instance Data.FromJSON TrendArrowOptions where
  parseJSON :: Value -> Parser TrendArrowOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrendArrowOptions"
      ( \Object
x ->
          Maybe Visibility -> TrendArrowOptions
TrendArrowOptions'
            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 TrendArrowOptions where
  hashWithSalt :: Int -> TrendArrowOptions -> Int
hashWithSalt Int
_salt TrendArrowOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:TrendArrowOptions' :: TrendArrowOptions -> Maybe Visibility
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

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

instance Data.ToJSON TrendArrowOptions where
  toJSON :: TrendArrowOptions -> Value
toJSON TrendArrowOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:TrendArrowOptions' :: TrendArrowOptions -> 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]
      )