{-# 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.HeatMapVisual
-- 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.HeatMapVisual 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.ColumnHierarchy
import Amazonka.QuickSight.Types.HeatMapConfiguration
import Amazonka.QuickSight.Types.VisualCustomAction
import Amazonka.QuickSight.Types.VisualSubtitleLabelOptions
import Amazonka.QuickSight.Types.VisualTitleLabelOptions

-- | A heat map.
--
-- For more information, see
-- <https://docs.aws.amazon.com/quicksight/latest/user/heat-map.html Using heat maps>
-- in the /Amazon QuickSight User Guide/.
--
-- /See:/ 'newHeatMapVisual' smart constructor.
data HeatMapVisual = HeatMapVisual'
  { -- | The list of custom actions that are configured for a visual.
    HeatMapVisual -> Maybe [VisualCustomAction]
actions :: Prelude.Maybe [VisualCustomAction],
    -- | The configuration of a heat map.
    HeatMapVisual -> Maybe HeatMapConfiguration
chartConfiguration :: Prelude.Maybe HeatMapConfiguration,
    -- | The column hierarchy that is used during drill-downs and drill-ups.
    HeatMapVisual -> Maybe [ColumnHierarchy]
columnHierarchies :: Prelude.Maybe [ColumnHierarchy],
    -- | The subtitle that is displayed on the visual.
    HeatMapVisual -> Maybe VisualSubtitleLabelOptions
subtitle :: Prelude.Maybe VisualSubtitleLabelOptions,
    -- | The title that is displayed on the visual.
    HeatMapVisual -> Maybe VisualTitleLabelOptions
title :: Prelude.Maybe VisualTitleLabelOptions,
    -- | The unique identifier of a visual. This identifier must be unique within
    -- the context of a dashboard, template, or analysis. Two dashboards,
    -- analyses, or templates can have visuals with the same identifiers.
    HeatMapVisual -> Text
visualId :: Prelude.Text
  }
  deriving (HeatMapVisual -> HeatMapVisual -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeatMapVisual -> HeatMapVisual -> Bool
$c/= :: HeatMapVisual -> HeatMapVisual -> Bool
== :: HeatMapVisual -> HeatMapVisual -> Bool
$c== :: HeatMapVisual -> HeatMapVisual -> Bool
Prelude.Eq, Int -> HeatMapVisual -> ShowS
[HeatMapVisual] -> ShowS
HeatMapVisual -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeatMapVisual] -> ShowS
$cshowList :: [HeatMapVisual] -> ShowS
show :: HeatMapVisual -> String
$cshow :: HeatMapVisual -> String
showsPrec :: Int -> HeatMapVisual -> ShowS
$cshowsPrec :: Int -> HeatMapVisual -> ShowS
Prelude.Show, forall x. Rep HeatMapVisual x -> HeatMapVisual
forall x. HeatMapVisual -> Rep HeatMapVisual x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeatMapVisual x -> HeatMapVisual
$cfrom :: forall x. HeatMapVisual -> Rep HeatMapVisual x
Prelude.Generic)

-- |
-- Create a value of 'HeatMapVisual' 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:
--
-- 'actions', 'heatMapVisual_actions' - The list of custom actions that are configured for a visual.
--
-- 'chartConfiguration', 'heatMapVisual_chartConfiguration' - The configuration of a heat map.
--
-- 'columnHierarchies', 'heatMapVisual_columnHierarchies' - The column hierarchy that is used during drill-downs and drill-ups.
--
-- 'subtitle', 'heatMapVisual_subtitle' - The subtitle that is displayed on the visual.
--
-- 'title', 'heatMapVisual_title' - The title that is displayed on the visual.
--
-- 'visualId', 'heatMapVisual_visualId' - The unique identifier of a visual. This identifier must be unique within
-- the context of a dashboard, template, or analysis. Two dashboards,
-- analyses, or templates can have visuals with the same identifiers.
newHeatMapVisual ::
  -- | 'visualId'
  Prelude.Text ->
  HeatMapVisual
newHeatMapVisual :: Text -> HeatMapVisual
newHeatMapVisual Text
pVisualId_ =
  HeatMapVisual'
    { $sel:actions:HeatMapVisual' :: Maybe [VisualCustomAction]
actions = forall a. Maybe a
Prelude.Nothing,
      $sel:chartConfiguration:HeatMapVisual' :: Maybe HeatMapConfiguration
chartConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:columnHierarchies:HeatMapVisual' :: Maybe [ColumnHierarchy]
columnHierarchies = forall a. Maybe a
Prelude.Nothing,
      $sel:subtitle:HeatMapVisual' :: Maybe VisualSubtitleLabelOptions
subtitle = forall a. Maybe a
Prelude.Nothing,
      $sel:title:HeatMapVisual' :: Maybe VisualTitleLabelOptions
title = forall a. Maybe a
Prelude.Nothing,
      $sel:visualId:HeatMapVisual' :: Text
visualId = Text
pVisualId_
    }

-- | The list of custom actions that are configured for a visual.
heatMapVisual_actions :: Lens.Lens' HeatMapVisual (Prelude.Maybe [VisualCustomAction])
heatMapVisual_actions :: Lens' HeatMapVisual (Maybe [VisualCustomAction])
heatMapVisual_actions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Maybe [VisualCustomAction]
actions :: Maybe [VisualCustomAction]
$sel:actions:HeatMapVisual' :: HeatMapVisual -> Maybe [VisualCustomAction]
actions} -> Maybe [VisualCustomAction]
actions) (\s :: HeatMapVisual
s@HeatMapVisual' {} Maybe [VisualCustomAction]
a -> HeatMapVisual
s {$sel:actions:HeatMapVisual' :: Maybe [VisualCustomAction]
actions = Maybe [VisualCustomAction]
a} :: HeatMapVisual) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The configuration of a heat map.
heatMapVisual_chartConfiguration :: Lens.Lens' HeatMapVisual (Prelude.Maybe HeatMapConfiguration)
heatMapVisual_chartConfiguration :: Lens' HeatMapVisual (Maybe HeatMapConfiguration)
heatMapVisual_chartConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Maybe HeatMapConfiguration
chartConfiguration :: Maybe HeatMapConfiguration
$sel:chartConfiguration:HeatMapVisual' :: HeatMapVisual -> Maybe HeatMapConfiguration
chartConfiguration} -> Maybe HeatMapConfiguration
chartConfiguration) (\s :: HeatMapVisual
s@HeatMapVisual' {} Maybe HeatMapConfiguration
a -> HeatMapVisual
s {$sel:chartConfiguration:HeatMapVisual' :: Maybe HeatMapConfiguration
chartConfiguration = Maybe HeatMapConfiguration
a} :: HeatMapVisual)

-- | The column hierarchy that is used during drill-downs and drill-ups.
heatMapVisual_columnHierarchies :: Lens.Lens' HeatMapVisual (Prelude.Maybe [ColumnHierarchy])
heatMapVisual_columnHierarchies :: Lens' HeatMapVisual (Maybe [ColumnHierarchy])
heatMapVisual_columnHierarchies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Maybe [ColumnHierarchy]
columnHierarchies :: Maybe [ColumnHierarchy]
$sel:columnHierarchies:HeatMapVisual' :: HeatMapVisual -> Maybe [ColumnHierarchy]
columnHierarchies} -> Maybe [ColumnHierarchy]
columnHierarchies) (\s :: HeatMapVisual
s@HeatMapVisual' {} Maybe [ColumnHierarchy]
a -> HeatMapVisual
s {$sel:columnHierarchies:HeatMapVisual' :: Maybe [ColumnHierarchy]
columnHierarchies = Maybe [ColumnHierarchy]
a} :: HeatMapVisual) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The subtitle that is displayed on the visual.
heatMapVisual_subtitle :: Lens.Lens' HeatMapVisual (Prelude.Maybe VisualSubtitleLabelOptions)
heatMapVisual_subtitle :: Lens' HeatMapVisual (Maybe VisualSubtitleLabelOptions)
heatMapVisual_subtitle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Maybe VisualSubtitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
$sel:subtitle:HeatMapVisual' :: HeatMapVisual -> Maybe VisualSubtitleLabelOptions
subtitle} -> Maybe VisualSubtitleLabelOptions
subtitle) (\s :: HeatMapVisual
s@HeatMapVisual' {} Maybe VisualSubtitleLabelOptions
a -> HeatMapVisual
s {$sel:subtitle:HeatMapVisual' :: Maybe VisualSubtitleLabelOptions
subtitle = Maybe VisualSubtitleLabelOptions
a} :: HeatMapVisual)

-- | The title that is displayed on the visual.
heatMapVisual_title :: Lens.Lens' HeatMapVisual (Prelude.Maybe VisualTitleLabelOptions)
heatMapVisual_title :: Lens' HeatMapVisual (Maybe VisualTitleLabelOptions)
heatMapVisual_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Maybe VisualTitleLabelOptions
title :: Maybe VisualTitleLabelOptions
$sel:title:HeatMapVisual' :: HeatMapVisual -> Maybe VisualTitleLabelOptions
title} -> Maybe VisualTitleLabelOptions
title) (\s :: HeatMapVisual
s@HeatMapVisual' {} Maybe VisualTitleLabelOptions
a -> HeatMapVisual
s {$sel:title:HeatMapVisual' :: Maybe VisualTitleLabelOptions
title = Maybe VisualTitleLabelOptions
a} :: HeatMapVisual)

-- | The unique identifier of a visual. This identifier must be unique within
-- the context of a dashboard, template, or analysis. Two dashboards,
-- analyses, or templates can have visuals with the same identifiers.
heatMapVisual_visualId :: Lens.Lens' HeatMapVisual Prelude.Text
heatMapVisual_visualId :: Lens' HeatMapVisual Text
heatMapVisual_visualId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapVisual' {Text
visualId :: Text
$sel:visualId:HeatMapVisual' :: HeatMapVisual -> Text
visualId} -> Text
visualId) (\s :: HeatMapVisual
s@HeatMapVisual' {} Text
a -> HeatMapVisual
s {$sel:visualId:HeatMapVisual' :: Text
visualId = Text
a} :: HeatMapVisual)

instance Data.FromJSON HeatMapVisual where
  parseJSON :: Value -> Parser HeatMapVisual
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HeatMapVisual"
      ( \Object
x ->
          Maybe [VisualCustomAction]
-> Maybe HeatMapConfiguration
-> Maybe [ColumnHierarchy]
-> Maybe VisualSubtitleLabelOptions
-> Maybe VisualTitleLabelOptions
-> Text
-> HeatMapVisual
HeatMapVisual'
            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
"Actions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ChartConfiguration")
            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
"ColumnHierarchies"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"Subtitle")
            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
"Title")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"VisualId")
      )

instance Prelude.Hashable HeatMapVisual where
  hashWithSalt :: Int -> HeatMapVisual -> Int
hashWithSalt Int
_salt HeatMapVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe HeatMapConfiguration
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe HeatMapConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:HeatMapVisual' :: HeatMapVisual -> Text
$sel:title:HeatMapVisual' :: HeatMapVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:HeatMapVisual' :: HeatMapVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:HeatMapVisual' :: HeatMapVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:HeatMapVisual' :: HeatMapVisual -> Maybe HeatMapConfiguration
$sel:actions:HeatMapVisual' :: HeatMapVisual -> Maybe [VisualCustomAction]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [VisualCustomAction]
actions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HeatMapConfiguration
chartConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ColumnHierarchy]
columnHierarchies
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VisualSubtitleLabelOptions
subtitle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VisualTitleLabelOptions
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
visualId

instance Prelude.NFData HeatMapVisual where
  rnf :: HeatMapVisual -> ()
rnf HeatMapVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe HeatMapConfiguration
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe HeatMapConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:HeatMapVisual' :: HeatMapVisual -> Text
$sel:title:HeatMapVisual' :: HeatMapVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:HeatMapVisual' :: HeatMapVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:HeatMapVisual' :: HeatMapVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:HeatMapVisual' :: HeatMapVisual -> Maybe HeatMapConfiguration
$sel:actions:HeatMapVisual' :: HeatMapVisual -> Maybe [VisualCustomAction]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [VisualCustomAction]
actions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HeatMapConfiguration
chartConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ColumnHierarchy]
columnHierarchies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VisualSubtitleLabelOptions
subtitle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VisualTitleLabelOptions
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
visualId

instance Data.ToJSON HeatMapVisual where
  toJSON :: HeatMapVisual -> Value
toJSON HeatMapVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe HeatMapConfiguration
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe HeatMapConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:HeatMapVisual' :: HeatMapVisual -> Text
$sel:title:HeatMapVisual' :: HeatMapVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:HeatMapVisual' :: HeatMapVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:HeatMapVisual' :: HeatMapVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:HeatMapVisual' :: HeatMapVisual -> Maybe HeatMapConfiguration
$sel:actions:HeatMapVisual' :: HeatMapVisual -> Maybe [VisualCustomAction]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Actions" 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 [VisualCustomAction]
actions,
            (Key
"ChartConfiguration" 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 HeatMapConfiguration
chartConfiguration,
            (Key
"ColumnHierarchies" 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 [ColumnHierarchy]
columnHierarchies,
            (Key
"Subtitle" 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 VisualSubtitleLabelOptions
subtitle,
            (Key
"Title" 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 VisualTitleLabelOptions
title,
            forall a. a -> Maybe a
Prelude.Just (Key
"VisualId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
visualId)
          ]
      )