{-# 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.SectionPageBreakConfiguration
-- 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.SectionPageBreakConfiguration 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.SectionAfterPageBreak

-- | The configuration of a page break for a section.
--
-- /See:/ 'newSectionPageBreakConfiguration' smart constructor.
data SectionPageBreakConfiguration = SectionPageBreakConfiguration'
  { -- | The configuration of a page break after a section.
    SectionPageBreakConfiguration -> Maybe SectionAfterPageBreak
after :: Prelude.Maybe SectionAfterPageBreak
  }
  deriving (SectionPageBreakConfiguration
-> SectionPageBreakConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SectionPageBreakConfiguration
-> SectionPageBreakConfiguration -> Bool
$c/= :: SectionPageBreakConfiguration
-> SectionPageBreakConfiguration -> Bool
== :: SectionPageBreakConfiguration
-> SectionPageBreakConfiguration -> Bool
$c== :: SectionPageBreakConfiguration
-> SectionPageBreakConfiguration -> Bool
Prelude.Eq, ReadPrec [SectionPageBreakConfiguration]
ReadPrec SectionPageBreakConfiguration
Int -> ReadS SectionPageBreakConfiguration
ReadS [SectionPageBreakConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SectionPageBreakConfiguration]
$creadListPrec :: ReadPrec [SectionPageBreakConfiguration]
readPrec :: ReadPrec SectionPageBreakConfiguration
$creadPrec :: ReadPrec SectionPageBreakConfiguration
readList :: ReadS [SectionPageBreakConfiguration]
$creadList :: ReadS [SectionPageBreakConfiguration]
readsPrec :: Int -> ReadS SectionPageBreakConfiguration
$creadsPrec :: Int -> ReadS SectionPageBreakConfiguration
Prelude.Read, Int -> SectionPageBreakConfiguration -> ShowS
[SectionPageBreakConfiguration] -> ShowS
SectionPageBreakConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SectionPageBreakConfiguration] -> ShowS
$cshowList :: [SectionPageBreakConfiguration] -> ShowS
show :: SectionPageBreakConfiguration -> String
$cshow :: SectionPageBreakConfiguration -> String
showsPrec :: Int -> SectionPageBreakConfiguration -> ShowS
$cshowsPrec :: Int -> SectionPageBreakConfiguration -> ShowS
Prelude.Show, forall x.
Rep SectionPageBreakConfiguration x
-> SectionPageBreakConfiguration
forall x.
SectionPageBreakConfiguration
-> Rep SectionPageBreakConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SectionPageBreakConfiguration x
-> SectionPageBreakConfiguration
$cfrom :: forall x.
SectionPageBreakConfiguration
-> Rep SectionPageBreakConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SectionPageBreakConfiguration' 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:
--
-- 'after', 'sectionPageBreakConfiguration_after' - The configuration of a page break after a section.
newSectionPageBreakConfiguration ::
  SectionPageBreakConfiguration
newSectionPageBreakConfiguration :: SectionPageBreakConfiguration
newSectionPageBreakConfiguration =
  SectionPageBreakConfiguration'
    { $sel:after:SectionPageBreakConfiguration' :: Maybe SectionAfterPageBreak
after =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration of a page break after a section.
sectionPageBreakConfiguration_after :: Lens.Lens' SectionPageBreakConfiguration (Prelude.Maybe SectionAfterPageBreak)
sectionPageBreakConfiguration_after :: Lens' SectionPageBreakConfiguration (Maybe SectionAfterPageBreak)
sectionPageBreakConfiguration_after = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionPageBreakConfiguration' {Maybe SectionAfterPageBreak
after :: Maybe SectionAfterPageBreak
$sel:after:SectionPageBreakConfiguration' :: SectionPageBreakConfiguration -> Maybe SectionAfterPageBreak
after} -> Maybe SectionAfterPageBreak
after) (\s :: SectionPageBreakConfiguration
s@SectionPageBreakConfiguration' {} Maybe SectionAfterPageBreak
a -> SectionPageBreakConfiguration
s {$sel:after:SectionPageBreakConfiguration' :: Maybe SectionAfterPageBreak
after = Maybe SectionAfterPageBreak
a} :: SectionPageBreakConfiguration)

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

instance
  Prelude.Hashable
    SectionPageBreakConfiguration
  where
  hashWithSalt :: Int -> SectionPageBreakConfiguration -> Int
hashWithSalt Int
_salt SectionPageBreakConfiguration' {Maybe SectionAfterPageBreak
after :: Maybe SectionAfterPageBreak
$sel:after:SectionPageBreakConfiguration' :: SectionPageBreakConfiguration -> Maybe SectionAfterPageBreak
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SectionAfterPageBreak
after

instance Prelude.NFData SectionPageBreakConfiguration where
  rnf :: SectionPageBreakConfiguration -> ()
rnf SectionPageBreakConfiguration' {Maybe SectionAfterPageBreak
after :: Maybe SectionAfterPageBreak
$sel:after:SectionPageBreakConfiguration' :: SectionPageBreakConfiguration -> Maybe SectionAfterPageBreak
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SectionAfterPageBreak
after

instance Data.ToJSON SectionPageBreakConfiguration where
  toJSON :: SectionPageBreakConfiguration -> Value
toJSON SectionPageBreakConfiguration' {Maybe SectionAfterPageBreak
after :: Maybe SectionAfterPageBreak
$sel:after:SectionPageBreakConfiguration' :: SectionPageBreakConfiguration -> Maybe SectionAfterPageBreak
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"After" 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 SectionAfterPageBreak
after]
      )