{-# 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.HeatMapSortConfiguration
-- 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.HeatMapSortConfiguration 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.FieldSortOptions
import Amazonka.QuickSight.Types.ItemsLimitConfiguration

-- | The sort configuration of a heat map.
--
-- /See:/ 'newHeatMapSortConfiguration' smart constructor.
data HeatMapSortConfiguration = HeatMapSortConfiguration'
  { -- | The limit on the number of columns that are displayed in a heat map.
    HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration :: Prelude.Maybe ItemsLimitConfiguration,
    -- | The column sort configuration for heat map for columns that aren\'t a
    -- part of a field well.
    HeatMapSortConfiguration -> Maybe [FieldSortOptions]
heatMapColumnSort :: Prelude.Maybe [FieldSortOptions],
    -- | The limit on the number of rows that are displayed in a heat map.
    HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration :: Prelude.Maybe ItemsLimitConfiguration,
    -- | The field sort configuration of the rows fields.
    HeatMapSortConfiguration -> Maybe [FieldSortOptions]
heatMapRowSort :: Prelude.Maybe [FieldSortOptions]
  }
  deriving (HeatMapSortConfiguration -> HeatMapSortConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeatMapSortConfiguration -> HeatMapSortConfiguration -> Bool
$c/= :: HeatMapSortConfiguration -> HeatMapSortConfiguration -> Bool
== :: HeatMapSortConfiguration -> HeatMapSortConfiguration -> Bool
$c== :: HeatMapSortConfiguration -> HeatMapSortConfiguration -> Bool
Prelude.Eq, ReadPrec [HeatMapSortConfiguration]
ReadPrec HeatMapSortConfiguration
Int -> ReadS HeatMapSortConfiguration
ReadS [HeatMapSortConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HeatMapSortConfiguration]
$creadListPrec :: ReadPrec [HeatMapSortConfiguration]
readPrec :: ReadPrec HeatMapSortConfiguration
$creadPrec :: ReadPrec HeatMapSortConfiguration
readList :: ReadS [HeatMapSortConfiguration]
$creadList :: ReadS [HeatMapSortConfiguration]
readsPrec :: Int -> ReadS HeatMapSortConfiguration
$creadsPrec :: Int -> ReadS HeatMapSortConfiguration
Prelude.Read, Int -> HeatMapSortConfiguration -> ShowS
[HeatMapSortConfiguration] -> ShowS
HeatMapSortConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeatMapSortConfiguration] -> ShowS
$cshowList :: [HeatMapSortConfiguration] -> ShowS
show :: HeatMapSortConfiguration -> String
$cshow :: HeatMapSortConfiguration -> String
showsPrec :: Int -> HeatMapSortConfiguration -> ShowS
$cshowsPrec :: Int -> HeatMapSortConfiguration -> ShowS
Prelude.Show, forall x.
Rep HeatMapSortConfiguration x -> HeatMapSortConfiguration
forall x.
HeatMapSortConfiguration -> Rep HeatMapSortConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HeatMapSortConfiguration x -> HeatMapSortConfiguration
$cfrom :: forall x.
HeatMapSortConfiguration -> Rep HeatMapSortConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'HeatMapSortConfiguration' 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:
--
-- 'heatMapColumnItemsLimitConfiguration', 'heatMapSortConfiguration_heatMapColumnItemsLimitConfiguration' - The limit on the number of columns that are displayed in a heat map.
--
-- 'heatMapColumnSort', 'heatMapSortConfiguration_heatMapColumnSort' - The column sort configuration for heat map for columns that aren\'t a
-- part of a field well.
--
-- 'heatMapRowItemsLimitConfiguration', 'heatMapSortConfiguration_heatMapRowItemsLimitConfiguration' - The limit on the number of rows that are displayed in a heat map.
--
-- 'heatMapRowSort', 'heatMapSortConfiguration_heatMapRowSort' - The field sort configuration of the rows fields.
newHeatMapSortConfiguration ::
  HeatMapSortConfiguration
newHeatMapSortConfiguration :: HeatMapSortConfiguration
newHeatMapSortConfiguration =
  HeatMapSortConfiguration'
    { $sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:heatMapColumnSort:HeatMapSortConfiguration' :: Maybe [FieldSortOptions]
heatMapColumnSort = forall a. Maybe a
Prelude.Nothing,
      $sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:heatMapRowSort:HeatMapSortConfiguration' :: Maybe [FieldSortOptions]
heatMapRowSort = forall a. Maybe a
Prelude.Nothing
    }

-- | The limit on the number of columns that are displayed in a heat map.
heatMapSortConfiguration_heatMapColumnItemsLimitConfiguration :: Lens.Lens' HeatMapSortConfiguration (Prelude.Maybe ItemsLimitConfiguration)
heatMapSortConfiguration_heatMapColumnItemsLimitConfiguration :: Lens' HeatMapSortConfiguration (Maybe ItemsLimitConfiguration)
heatMapSortConfiguration_heatMapColumnItemsLimitConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapSortConfiguration' {Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
$sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration} -> Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration) (\s :: HeatMapSortConfiguration
s@HeatMapSortConfiguration' {} Maybe ItemsLimitConfiguration
a -> HeatMapSortConfiguration
s {$sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration = Maybe ItemsLimitConfiguration
a} :: HeatMapSortConfiguration)

-- | The column sort configuration for heat map for columns that aren\'t a
-- part of a field well.
heatMapSortConfiguration_heatMapColumnSort :: Lens.Lens' HeatMapSortConfiguration (Prelude.Maybe [FieldSortOptions])
heatMapSortConfiguration_heatMapColumnSort :: Lens' HeatMapSortConfiguration (Maybe [FieldSortOptions])
heatMapSortConfiguration_heatMapColumnSort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapSortConfiguration' {Maybe [FieldSortOptions]
heatMapColumnSort :: Maybe [FieldSortOptions]
$sel:heatMapColumnSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
heatMapColumnSort} -> Maybe [FieldSortOptions]
heatMapColumnSort) (\s :: HeatMapSortConfiguration
s@HeatMapSortConfiguration' {} Maybe [FieldSortOptions]
a -> HeatMapSortConfiguration
s {$sel:heatMapColumnSort:HeatMapSortConfiguration' :: Maybe [FieldSortOptions]
heatMapColumnSort = Maybe [FieldSortOptions]
a} :: HeatMapSortConfiguration) 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 limit on the number of rows that are displayed in a heat map.
heatMapSortConfiguration_heatMapRowItemsLimitConfiguration :: Lens.Lens' HeatMapSortConfiguration (Prelude.Maybe ItemsLimitConfiguration)
heatMapSortConfiguration_heatMapRowItemsLimitConfiguration :: Lens' HeatMapSortConfiguration (Maybe ItemsLimitConfiguration)
heatMapSortConfiguration_heatMapRowItemsLimitConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapSortConfiguration' {Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
$sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration} -> Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration) (\s :: HeatMapSortConfiguration
s@HeatMapSortConfiguration' {} Maybe ItemsLimitConfiguration
a -> HeatMapSortConfiguration
s {$sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration = Maybe ItemsLimitConfiguration
a} :: HeatMapSortConfiguration)

-- | The field sort configuration of the rows fields.
heatMapSortConfiguration_heatMapRowSort :: Lens.Lens' HeatMapSortConfiguration (Prelude.Maybe [FieldSortOptions])
heatMapSortConfiguration_heatMapRowSort :: Lens' HeatMapSortConfiguration (Maybe [FieldSortOptions])
heatMapSortConfiguration_heatMapRowSort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeatMapSortConfiguration' {Maybe [FieldSortOptions]
heatMapRowSort :: Maybe [FieldSortOptions]
$sel:heatMapRowSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
heatMapRowSort} -> Maybe [FieldSortOptions]
heatMapRowSort) (\s :: HeatMapSortConfiguration
s@HeatMapSortConfiguration' {} Maybe [FieldSortOptions]
a -> HeatMapSortConfiguration
s {$sel:heatMapRowSort:HeatMapSortConfiguration' :: Maybe [FieldSortOptions]
heatMapRowSort = Maybe [FieldSortOptions]
a} :: HeatMapSortConfiguration) 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

instance Data.FromJSON HeatMapSortConfiguration where
  parseJSON :: Value -> Parser HeatMapSortConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HeatMapSortConfiguration"
      ( \Object
x ->
          Maybe ItemsLimitConfiguration
-> Maybe [FieldSortOptions]
-> Maybe ItemsLimitConfiguration
-> Maybe [FieldSortOptions]
-> HeatMapSortConfiguration
HeatMapSortConfiguration'
            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
"HeatMapColumnItemsLimitConfiguration")
            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
"HeatMapColumnSort"
                            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
"HeatMapRowItemsLimitConfiguration")
            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
"HeatMapRowSort"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable HeatMapSortConfiguration where
  hashWithSalt :: Int -> HeatMapSortConfiguration -> Int
hashWithSalt Int
_salt HeatMapSortConfiguration' {Maybe [FieldSortOptions]
Maybe ItemsLimitConfiguration
heatMapRowSort :: Maybe [FieldSortOptions]
heatMapRowItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
heatMapColumnSort :: Maybe [FieldSortOptions]
heatMapColumnItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
$sel:heatMapRowSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
$sel:heatMapColumnSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FieldSortOptions]
heatMapColumnSort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FieldSortOptions]
heatMapRowSort

instance Prelude.NFData HeatMapSortConfiguration where
  rnf :: HeatMapSortConfiguration -> ()
rnf HeatMapSortConfiguration' {Maybe [FieldSortOptions]
Maybe ItemsLimitConfiguration
heatMapRowSort :: Maybe [FieldSortOptions]
heatMapRowItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
heatMapColumnSort :: Maybe [FieldSortOptions]
heatMapColumnItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
$sel:heatMapRowSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
$sel:heatMapColumnSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [FieldSortOptions]
heatMapColumnSort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [FieldSortOptions]
heatMapRowSort

instance Data.ToJSON HeatMapSortConfiguration where
  toJSON :: HeatMapSortConfiguration -> Value
toJSON HeatMapSortConfiguration' {Maybe [FieldSortOptions]
Maybe ItemsLimitConfiguration
heatMapRowSort :: Maybe [FieldSortOptions]
heatMapRowItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
heatMapColumnSort :: Maybe [FieldSortOptions]
heatMapColumnItemsLimitConfiguration :: Maybe ItemsLimitConfiguration
$sel:heatMapRowSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapRowItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
$sel:heatMapColumnSort:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe [FieldSortOptions]
$sel:heatMapColumnItemsLimitConfiguration:HeatMapSortConfiguration' :: HeatMapSortConfiguration -> Maybe ItemsLimitConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"HeatMapColumnItemsLimitConfiguration" 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 ItemsLimitConfiguration
heatMapColumnItemsLimitConfiguration,
            (Key
"HeatMapColumnSort" 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 [FieldSortOptions]
heatMapColumnSort,
            (Key
"HeatMapRowItemsLimitConfiguration" 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 ItemsLimitConfiguration
heatMapRowItemsLimitConfiguration,
            (Key
"HeatMapRowSort" 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 [FieldSortOptions]
heatMapRowSort
          ]
      )