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

-- | A box plot.
--
-- For more information, see
-- <https://docs.aws.amazon.com/quicksight/latest/user/box-plots.html Using box plots>
-- in the /Amazon QuickSight User Guide/.
--
-- /See:/ 'newBoxPlotVisual' smart constructor.
data BoxPlotVisual = BoxPlotVisual'
  { -- | The list of custom actions that are configured for a visual.
    BoxPlotVisual -> Maybe [VisualCustomAction]
actions :: Prelude.Maybe [VisualCustomAction],
    -- | The configuration settings of the visual.
    BoxPlotVisual -> Maybe BoxPlotChartConfiguration
chartConfiguration :: Prelude.Maybe BoxPlotChartConfiguration,
    -- | The column hierarchy that is used during drill-downs and drill-ups.
    BoxPlotVisual -> Maybe [ColumnHierarchy]
columnHierarchies :: Prelude.Maybe [ColumnHierarchy],
    -- | The subtitle that is displayed on the visual.
    BoxPlotVisual -> Maybe VisualSubtitleLabelOptions
subtitle :: Prelude.Maybe VisualSubtitleLabelOptions,
    -- | The title that is displayed on the visual.
    BoxPlotVisual -> 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..
    BoxPlotVisual -> Text
visualId :: Prelude.Text
  }
  deriving (BoxPlotVisual -> BoxPlotVisual -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BoxPlotVisual -> BoxPlotVisual -> Bool
$c/= :: BoxPlotVisual -> BoxPlotVisual -> Bool
== :: BoxPlotVisual -> BoxPlotVisual -> Bool
$c== :: BoxPlotVisual -> BoxPlotVisual -> Bool
Prelude.Eq, Int -> BoxPlotVisual -> ShowS
[BoxPlotVisual] -> ShowS
BoxPlotVisual -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BoxPlotVisual] -> ShowS
$cshowList :: [BoxPlotVisual] -> ShowS
show :: BoxPlotVisual -> String
$cshow :: BoxPlotVisual -> String
showsPrec :: Int -> BoxPlotVisual -> ShowS
$cshowsPrec :: Int -> BoxPlotVisual -> ShowS
Prelude.Show, forall x. Rep BoxPlotVisual x -> BoxPlotVisual
forall x. BoxPlotVisual -> Rep BoxPlotVisual x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BoxPlotVisual x -> BoxPlotVisual
$cfrom :: forall x. BoxPlotVisual -> Rep BoxPlotVisual x
Prelude.Generic)

-- |
-- Create a value of 'BoxPlotVisual' 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', 'boxPlotVisual_actions' - The list of custom actions that are configured for a visual.
--
-- 'chartConfiguration', 'boxPlotVisual_chartConfiguration' - The configuration settings of the visual.
--
-- 'columnHierarchies', 'boxPlotVisual_columnHierarchies' - The column hierarchy that is used during drill-downs and drill-ups.
--
-- 'subtitle', 'boxPlotVisual_subtitle' - The subtitle that is displayed on the visual.
--
-- 'title', 'boxPlotVisual_title' - The title that is displayed on the visual.
--
-- 'visualId', 'boxPlotVisual_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..
newBoxPlotVisual ::
  -- | 'visualId'
  Prelude.Text ->
  BoxPlotVisual
newBoxPlotVisual :: Text -> BoxPlotVisual
newBoxPlotVisual Text
pVisualId_ =
  BoxPlotVisual'
    { $sel:actions:BoxPlotVisual' :: Maybe [VisualCustomAction]
actions = forall a. Maybe a
Prelude.Nothing,
      $sel:chartConfiguration:BoxPlotVisual' :: Maybe BoxPlotChartConfiguration
chartConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:columnHierarchies:BoxPlotVisual' :: Maybe [ColumnHierarchy]
columnHierarchies = forall a. Maybe a
Prelude.Nothing,
      $sel:subtitle:BoxPlotVisual' :: Maybe VisualSubtitleLabelOptions
subtitle = forall a. Maybe a
Prelude.Nothing,
      $sel:title:BoxPlotVisual' :: Maybe VisualTitleLabelOptions
title = forall a. Maybe a
Prelude.Nothing,
      $sel:visualId:BoxPlotVisual' :: Text
visualId = Text
pVisualId_
    }

-- | The list of custom actions that are configured for a visual.
boxPlotVisual_actions :: Lens.Lens' BoxPlotVisual (Prelude.Maybe [VisualCustomAction])
boxPlotVisual_actions :: Lens' BoxPlotVisual (Maybe [VisualCustomAction])
boxPlotVisual_actions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotVisual' {Maybe [VisualCustomAction]
actions :: Maybe [VisualCustomAction]
$sel:actions:BoxPlotVisual' :: BoxPlotVisual -> Maybe [VisualCustomAction]
actions} -> Maybe [VisualCustomAction]
actions) (\s :: BoxPlotVisual
s@BoxPlotVisual' {} Maybe [VisualCustomAction]
a -> BoxPlotVisual
s {$sel:actions:BoxPlotVisual' :: Maybe [VisualCustomAction]
actions = Maybe [VisualCustomAction]
a} :: BoxPlotVisual) 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 settings of the visual.
boxPlotVisual_chartConfiguration :: Lens.Lens' BoxPlotVisual (Prelude.Maybe BoxPlotChartConfiguration)
boxPlotVisual_chartConfiguration :: Lens' BoxPlotVisual (Maybe BoxPlotChartConfiguration)
boxPlotVisual_chartConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotVisual' {Maybe BoxPlotChartConfiguration
chartConfiguration :: Maybe BoxPlotChartConfiguration
$sel:chartConfiguration:BoxPlotVisual' :: BoxPlotVisual -> Maybe BoxPlotChartConfiguration
chartConfiguration} -> Maybe BoxPlotChartConfiguration
chartConfiguration) (\s :: BoxPlotVisual
s@BoxPlotVisual' {} Maybe BoxPlotChartConfiguration
a -> BoxPlotVisual
s {$sel:chartConfiguration:BoxPlotVisual' :: Maybe BoxPlotChartConfiguration
chartConfiguration = Maybe BoxPlotChartConfiguration
a} :: BoxPlotVisual)

-- | The column hierarchy that is used during drill-downs and drill-ups.
boxPlotVisual_columnHierarchies :: Lens.Lens' BoxPlotVisual (Prelude.Maybe [ColumnHierarchy])
boxPlotVisual_columnHierarchies :: Lens' BoxPlotVisual (Maybe [ColumnHierarchy])
boxPlotVisual_columnHierarchies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotVisual' {Maybe [ColumnHierarchy]
columnHierarchies :: Maybe [ColumnHierarchy]
$sel:columnHierarchies:BoxPlotVisual' :: BoxPlotVisual -> Maybe [ColumnHierarchy]
columnHierarchies} -> Maybe [ColumnHierarchy]
columnHierarchies) (\s :: BoxPlotVisual
s@BoxPlotVisual' {} Maybe [ColumnHierarchy]
a -> BoxPlotVisual
s {$sel:columnHierarchies:BoxPlotVisual' :: Maybe [ColumnHierarchy]
columnHierarchies = Maybe [ColumnHierarchy]
a} :: BoxPlotVisual) 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.
boxPlotVisual_subtitle :: Lens.Lens' BoxPlotVisual (Prelude.Maybe VisualSubtitleLabelOptions)
boxPlotVisual_subtitle :: Lens' BoxPlotVisual (Maybe VisualSubtitleLabelOptions)
boxPlotVisual_subtitle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotVisual' {Maybe VisualSubtitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
$sel:subtitle:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualSubtitleLabelOptions
subtitle} -> Maybe VisualSubtitleLabelOptions
subtitle) (\s :: BoxPlotVisual
s@BoxPlotVisual' {} Maybe VisualSubtitleLabelOptions
a -> BoxPlotVisual
s {$sel:subtitle:BoxPlotVisual' :: Maybe VisualSubtitleLabelOptions
subtitle = Maybe VisualSubtitleLabelOptions
a} :: BoxPlotVisual)

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

-- | 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..
boxPlotVisual_visualId :: Lens.Lens' BoxPlotVisual Prelude.Text
boxPlotVisual_visualId :: Lens' BoxPlotVisual Text
boxPlotVisual_visualId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotVisual' {Text
visualId :: Text
$sel:visualId:BoxPlotVisual' :: BoxPlotVisual -> Text
visualId} -> Text
visualId) (\s :: BoxPlotVisual
s@BoxPlotVisual' {} Text
a -> BoxPlotVisual
s {$sel:visualId:BoxPlotVisual' :: Text
visualId = Text
a} :: BoxPlotVisual)

instance Data.FromJSON BoxPlotVisual where
  parseJSON :: Value -> Parser BoxPlotVisual
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BoxPlotVisual"
      ( \Object
x ->
          Maybe [VisualCustomAction]
-> Maybe BoxPlotChartConfiguration
-> Maybe [ColumnHierarchy]
-> Maybe VisualSubtitleLabelOptions
-> Maybe VisualTitleLabelOptions
-> Text
-> BoxPlotVisual
BoxPlotVisual'
            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 BoxPlotVisual where
  hashWithSalt :: Int -> BoxPlotVisual -> Int
hashWithSalt Int
_salt BoxPlotVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Maybe BoxPlotChartConfiguration
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe BoxPlotChartConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:BoxPlotVisual' :: BoxPlotVisual -> Text
$sel:title:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:BoxPlotVisual' :: BoxPlotVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:BoxPlotVisual' :: BoxPlotVisual -> Maybe BoxPlotChartConfiguration
$sel:actions:BoxPlotVisual' :: BoxPlotVisual -> 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 BoxPlotChartConfiguration
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 BoxPlotVisual where
  rnf :: BoxPlotVisual -> ()
rnf BoxPlotVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Maybe BoxPlotChartConfiguration
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe BoxPlotChartConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:BoxPlotVisual' :: BoxPlotVisual -> Text
$sel:title:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:BoxPlotVisual' :: BoxPlotVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:BoxPlotVisual' :: BoxPlotVisual -> Maybe BoxPlotChartConfiguration
$sel:actions:BoxPlotVisual' :: BoxPlotVisual -> 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 BoxPlotChartConfiguration
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 BoxPlotVisual where
  toJSON :: BoxPlotVisual -> Value
toJSON BoxPlotVisual' {Maybe [ColumnHierarchy]
Maybe [VisualCustomAction]
Maybe VisualSubtitleLabelOptions
Maybe VisualTitleLabelOptions
Maybe BoxPlotChartConfiguration
Text
visualId :: Text
title :: Maybe VisualTitleLabelOptions
subtitle :: Maybe VisualSubtitleLabelOptions
columnHierarchies :: Maybe [ColumnHierarchy]
chartConfiguration :: Maybe BoxPlotChartConfiguration
actions :: Maybe [VisualCustomAction]
$sel:visualId:BoxPlotVisual' :: BoxPlotVisual -> Text
$sel:title:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualTitleLabelOptions
$sel:subtitle:BoxPlotVisual' :: BoxPlotVisual -> Maybe VisualSubtitleLabelOptions
$sel:columnHierarchies:BoxPlotVisual' :: BoxPlotVisual -> Maybe [ColumnHierarchy]
$sel:chartConfiguration:BoxPlotVisual' :: BoxPlotVisual -> Maybe BoxPlotChartConfiguration
$sel:actions:BoxPlotVisual' :: BoxPlotVisual -> 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 BoxPlotChartConfiguration
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)
          ]
      )