{-# 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.ItemsLimitConfiguration
-- 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.ItemsLimitConfiguration 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.OtherCategories

-- | The limit configuration of the visual display for an axis.
--
-- /See:/ 'newItemsLimitConfiguration' smart constructor.
data ItemsLimitConfiguration = ItemsLimitConfiguration'
  { -- | The limit on how many items of a field are showed in the chart. For
    -- example, the number of slices that are displayed in a pie chart.
    ItemsLimitConfiguration -> Maybe Integer
itemsLimit :: Prelude.Maybe Prelude.Integer,
    -- | The @Show other@ of an axis in the chart. Choose one of the following
    -- options:
    --
    -- -   @INCLUDE@
    --
    -- -   @EXCLUDE@
    ItemsLimitConfiguration -> Maybe OtherCategories
otherCategories :: Prelude.Maybe OtherCategories
  }
  deriving (ItemsLimitConfiguration -> ItemsLimitConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemsLimitConfiguration -> ItemsLimitConfiguration -> Bool
$c/= :: ItemsLimitConfiguration -> ItemsLimitConfiguration -> Bool
== :: ItemsLimitConfiguration -> ItemsLimitConfiguration -> Bool
$c== :: ItemsLimitConfiguration -> ItemsLimitConfiguration -> Bool
Prelude.Eq, ReadPrec [ItemsLimitConfiguration]
ReadPrec ItemsLimitConfiguration
Int -> ReadS ItemsLimitConfiguration
ReadS [ItemsLimitConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ItemsLimitConfiguration]
$creadListPrec :: ReadPrec [ItemsLimitConfiguration]
readPrec :: ReadPrec ItemsLimitConfiguration
$creadPrec :: ReadPrec ItemsLimitConfiguration
readList :: ReadS [ItemsLimitConfiguration]
$creadList :: ReadS [ItemsLimitConfiguration]
readsPrec :: Int -> ReadS ItemsLimitConfiguration
$creadsPrec :: Int -> ReadS ItemsLimitConfiguration
Prelude.Read, Int -> ItemsLimitConfiguration -> ShowS
[ItemsLimitConfiguration] -> ShowS
ItemsLimitConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemsLimitConfiguration] -> ShowS
$cshowList :: [ItemsLimitConfiguration] -> ShowS
show :: ItemsLimitConfiguration -> String
$cshow :: ItemsLimitConfiguration -> String
showsPrec :: Int -> ItemsLimitConfiguration -> ShowS
$cshowsPrec :: Int -> ItemsLimitConfiguration -> ShowS
Prelude.Show, forall x. Rep ItemsLimitConfiguration x -> ItemsLimitConfiguration
forall x. ItemsLimitConfiguration -> Rep ItemsLimitConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ItemsLimitConfiguration x -> ItemsLimitConfiguration
$cfrom :: forall x. ItemsLimitConfiguration -> Rep ItemsLimitConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ItemsLimitConfiguration' 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:
--
-- 'itemsLimit', 'itemsLimitConfiguration_itemsLimit' - The limit on how many items of a field are showed in the chart. For
-- example, the number of slices that are displayed in a pie chart.
--
-- 'otherCategories', 'itemsLimitConfiguration_otherCategories' - The @Show other@ of an axis in the chart. Choose one of the following
-- options:
--
-- -   @INCLUDE@
--
-- -   @EXCLUDE@
newItemsLimitConfiguration ::
  ItemsLimitConfiguration
newItemsLimitConfiguration :: ItemsLimitConfiguration
newItemsLimitConfiguration =
  ItemsLimitConfiguration'
    { $sel:itemsLimit:ItemsLimitConfiguration' :: Maybe Integer
itemsLimit =
        forall a. Maybe a
Prelude.Nothing,
      $sel:otherCategories:ItemsLimitConfiguration' :: Maybe OtherCategories
otherCategories = forall a. Maybe a
Prelude.Nothing
    }

-- | The limit on how many items of a field are showed in the chart. For
-- example, the number of slices that are displayed in a pie chart.
itemsLimitConfiguration_itemsLimit :: Lens.Lens' ItemsLimitConfiguration (Prelude.Maybe Prelude.Integer)
itemsLimitConfiguration_itemsLimit :: Lens' ItemsLimitConfiguration (Maybe Integer)
itemsLimitConfiguration_itemsLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemsLimitConfiguration' {Maybe Integer
itemsLimit :: Maybe Integer
$sel:itemsLimit:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe Integer
itemsLimit} -> Maybe Integer
itemsLimit) (\s :: ItemsLimitConfiguration
s@ItemsLimitConfiguration' {} Maybe Integer
a -> ItemsLimitConfiguration
s {$sel:itemsLimit:ItemsLimitConfiguration' :: Maybe Integer
itemsLimit = Maybe Integer
a} :: ItemsLimitConfiguration)

-- | The @Show other@ of an axis in the chart. Choose one of the following
-- options:
--
-- -   @INCLUDE@
--
-- -   @EXCLUDE@
itemsLimitConfiguration_otherCategories :: Lens.Lens' ItemsLimitConfiguration (Prelude.Maybe OtherCategories)
itemsLimitConfiguration_otherCategories :: Lens' ItemsLimitConfiguration (Maybe OtherCategories)
itemsLimitConfiguration_otherCategories = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemsLimitConfiguration' {Maybe OtherCategories
otherCategories :: Maybe OtherCategories
$sel:otherCategories:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe OtherCategories
otherCategories} -> Maybe OtherCategories
otherCategories) (\s :: ItemsLimitConfiguration
s@ItemsLimitConfiguration' {} Maybe OtherCategories
a -> ItemsLimitConfiguration
s {$sel:otherCategories:ItemsLimitConfiguration' :: Maybe OtherCategories
otherCategories = Maybe OtherCategories
a} :: ItemsLimitConfiguration)

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

instance Prelude.Hashable ItemsLimitConfiguration where
  hashWithSalt :: Int -> ItemsLimitConfiguration -> Int
hashWithSalt Int
_salt ItemsLimitConfiguration' {Maybe Integer
Maybe OtherCategories
otherCategories :: Maybe OtherCategories
itemsLimit :: Maybe Integer
$sel:otherCategories:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe OtherCategories
$sel:itemsLimit:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
itemsLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OtherCategories
otherCategories

instance Prelude.NFData ItemsLimitConfiguration where
  rnf :: ItemsLimitConfiguration -> ()
rnf ItemsLimitConfiguration' {Maybe Integer
Maybe OtherCategories
otherCategories :: Maybe OtherCategories
itemsLimit :: Maybe Integer
$sel:otherCategories:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe OtherCategories
$sel:itemsLimit:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
itemsLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OtherCategories
otherCategories

instance Data.ToJSON ItemsLimitConfiguration where
  toJSON :: ItemsLimitConfiguration -> Value
toJSON ItemsLimitConfiguration' {Maybe Integer
Maybe OtherCategories
otherCategories :: Maybe OtherCategories
itemsLimit :: Maybe Integer
$sel:otherCategories:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe OtherCategories
$sel:itemsLimit:ItemsLimitConfiguration' :: ItemsLimitConfiguration -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ItemsLimit" 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 Integer
itemsLimit,
            (Key
"OtherCategories" 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 OtherCategories
otherCategories
          ]
      )