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

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

-- |
-- Create a value of 'SectionAfterPageBreak' 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:
--
-- 'status', 'sectionAfterPageBreak_status' - The option that enables or disables a page break at the end of a
-- section.
newSectionAfterPageBreak ::
  SectionAfterPageBreak
newSectionAfterPageBreak :: SectionAfterPageBreak
newSectionAfterPageBreak =
  SectionAfterPageBreak' {$sel:status:SectionAfterPageBreak' :: Maybe SectionPageBreakStatus
status = forall a. Maybe a
Prelude.Nothing}

-- | The option that enables or disables a page break at the end of a
-- section.
sectionAfterPageBreak_status :: Lens.Lens' SectionAfterPageBreak (Prelude.Maybe SectionPageBreakStatus)
sectionAfterPageBreak_status :: Lens' SectionAfterPageBreak (Maybe SectionPageBreakStatus)
sectionAfterPageBreak_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionAfterPageBreak' {Maybe SectionPageBreakStatus
status :: Maybe SectionPageBreakStatus
$sel:status:SectionAfterPageBreak' :: SectionAfterPageBreak -> Maybe SectionPageBreakStatus
status} -> Maybe SectionPageBreakStatus
status) (\s :: SectionAfterPageBreak
s@SectionAfterPageBreak' {} Maybe SectionPageBreakStatus
a -> SectionAfterPageBreak
s {$sel:status:SectionAfterPageBreak' :: Maybe SectionPageBreakStatus
status = Maybe SectionPageBreakStatus
a} :: SectionAfterPageBreak)

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

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

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

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