{-# 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.BodySectionConfiguration
-- 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.BodySectionConfiguration 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.BodySectionContent
import Amazonka.QuickSight.Types.SectionPageBreakConfiguration
import Amazonka.QuickSight.Types.SectionStyle

-- | The configuration of a body section.
--
-- /See:/ 'newBodySectionConfiguration' smart constructor.
data BodySectionConfiguration = BodySectionConfiguration'
  { -- | The configuration of a page break for a section.
    BodySectionConfiguration -> Maybe SectionPageBreakConfiguration
pageBreakConfiguration :: Prelude.Maybe SectionPageBreakConfiguration,
    -- | The style options of a body section.
    BodySectionConfiguration -> Maybe SectionStyle
style :: Prelude.Maybe SectionStyle,
    -- | The unique identifier of a body section.
    BodySectionConfiguration -> Text
sectionId :: Prelude.Text,
    -- | The configuration of content in a body section.
    BodySectionConfiguration -> BodySectionContent
content :: BodySectionContent
  }
  deriving (BodySectionConfiguration -> BodySectionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BodySectionConfiguration -> BodySectionConfiguration -> Bool
$c/= :: BodySectionConfiguration -> BodySectionConfiguration -> Bool
== :: BodySectionConfiguration -> BodySectionConfiguration -> Bool
$c== :: BodySectionConfiguration -> BodySectionConfiguration -> Bool
Prelude.Eq, Int -> BodySectionConfiguration -> ShowS
[BodySectionConfiguration] -> ShowS
BodySectionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BodySectionConfiguration] -> ShowS
$cshowList :: [BodySectionConfiguration] -> ShowS
show :: BodySectionConfiguration -> String
$cshow :: BodySectionConfiguration -> String
showsPrec :: Int -> BodySectionConfiguration -> ShowS
$cshowsPrec :: Int -> BodySectionConfiguration -> ShowS
Prelude.Show, forall x.
Rep BodySectionConfiguration x -> BodySectionConfiguration
forall x.
BodySectionConfiguration -> Rep BodySectionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BodySectionConfiguration x -> BodySectionConfiguration
$cfrom :: forall x.
BodySectionConfiguration -> Rep BodySectionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'BodySectionConfiguration' 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:
--
-- 'pageBreakConfiguration', 'bodySectionConfiguration_pageBreakConfiguration' - The configuration of a page break for a section.
--
-- 'style', 'bodySectionConfiguration_style' - The style options of a body section.
--
-- 'sectionId', 'bodySectionConfiguration_sectionId' - The unique identifier of a body section.
--
-- 'content', 'bodySectionConfiguration_content' - The configuration of content in a body section.
newBodySectionConfiguration ::
  -- | 'sectionId'
  Prelude.Text ->
  -- | 'content'
  BodySectionContent ->
  BodySectionConfiguration
newBodySectionConfiguration :: Text -> BodySectionContent -> BodySectionConfiguration
newBodySectionConfiguration Text
pSectionId_ BodySectionContent
pContent_ =
  BodySectionConfiguration'
    { $sel:pageBreakConfiguration:BodySectionConfiguration' :: Maybe SectionPageBreakConfiguration
pageBreakConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:style:BodySectionConfiguration' :: Maybe SectionStyle
style = forall a. Maybe a
Prelude.Nothing,
      $sel:sectionId:BodySectionConfiguration' :: Text
sectionId = Text
pSectionId_,
      $sel:content:BodySectionConfiguration' :: BodySectionContent
content = BodySectionContent
pContent_
    }

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

-- | The style options of a body section.
bodySectionConfiguration_style :: Lens.Lens' BodySectionConfiguration (Prelude.Maybe SectionStyle)
bodySectionConfiguration_style :: Lens' BodySectionConfiguration (Maybe SectionStyle)
bodySectionConfiguration_style = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BodySectionConfiguration' {Maybe SectionStyle
style :: Maybe SectionStyle
$sel:style:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionStyle
style} -> Maybe SectionStyle
style) (\s :: BodySectionConfiguration
s@BodySectionConfiguration' {} Maybe SectionStyle
a -> BodySectionConfiguration
s {$sel:style:BodySectionConfiguration' :: Maybe SectionStyle
style = Maybe SectionStyle
a} :: BodySectionConfiguration)

-- | The unique identifier of a body section.
bodySectionConfiguration_sectionId :: Lens.Lens' BodySectionConfiguration Prelude.Text
bodySectionConfiguration_sectionId :: Lens' BodySectionConfiguration Text
bodySectionConfiguration_sectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BodySectionConfiguration' {Text
sectionId :: Text
$sel:sectionId:BodySectionConfiguration' :: BodySectionConfiguration -> Text
sectionId} -> Text
sectionId) (\s :: BodySectionConfiguration
s@BodySectionConfiguration' {} Text
a -> BodySectionConfiguration
s {$sel:sectionId:BodySectionConfiguration' :: Text
sectionId = Text
a} :: BodySectionConfiguration)

-- | The configuration of content in a body section.
bodySectionConfiguration_content :: Lens.Lens' BodySectionConfiguration BodySectionContent
bodySectionConfiguration_content :: Lens' BodySectionConfiguration BodySectionContent
bodySectionConfiguration_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BodySectionConfiguration' {BodySectionContent
content :: BodySectionContent
$sel:content:BodySectionConfiguration' :: BodySectionConfiguration -> BodySectionContent
content} -> BodySectionContent
content) (\s :: BodySectionConfiguration
s@BodySectionConfiguration' {} BodySectionContent
a -> BodySectionConfiguration
s {$sel:content:BodySectionConfiguration' :: BodySectionContent
content = BodySectionContent
a} :: BodySectionConfiguration)

instance Data.FromJSON BodySectionConfiguration where
  parseJSON :: Value -> Parser BodySectionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BodySectionConfiguration"
      ( \Object
x ->
          Maybe SectionPageBreakConfiguration
-> Maybe SectionStyle
-> Text
-> BodySectionContent
-> BodySectionConfiguration
BodySectionConfiguration'
            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
"PageBreakConfiguration")
            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
"Style")
            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
"SectionId")
            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
"Content")
      )

instance Prelude.Hashable BodySectionConfiguration where
  hashWithSalt :: Int -> BodySectionConfiguration -> Int
hashWithSalt Int
_salt BodySectionConfiguration' {Maybe SectionPageBreakConfiguration
Maybe SectionStyle
Text
BodySectionContent
content :: BodySectionContent
sectionId :: Text
style :: Maybe SectionStyle
pageBreakConfiguration :: Maybe SectionPageBreakConfiguration
$sel:content:BodySectionConfiguration' :: BodySectionConfiguration -> BodySectionContent
$sel:sectionId:BodySectionConfiguration' :: BodySectionConfiguration -> Text
$sel:style:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionStyle
$sel:pageBreakConfiguration:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionPageBreakConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SectionPageBreakConfiguration
pageBreakConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SectionStyle
style
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sectionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BodySectionContent
content

instance Prelude.NFData BodySectionConfiguration where
  rnf :: BodySectionConfiguration -> ()
rnf BodySectionConfiguration' {Maybe SectionPageBreakConfiguration
Maybe SectionStyle
Text
BodySectionContent
content :: BodySectionContent
sectionId :: Text
style :: Maybe SectionStyle
pageBreakConfiguration :: Maybe SectionPageBreakConfiguration
$sel:content:BodySectionConfiguration' :: BodySectionConfiguration -> BodySectionContent
$sel:sectionId:BodySectionConfiguration' :: BodySectionConfiguration -> Text
$sel:style:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionStyle
$sel:pageBreakConfiguration:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionPageBreakConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SectionPageBreakConfiguration
pageBreakConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SectionStyle
style
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sectionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BodySectionContent
content

instance Data.ToJSON BodySectionConfiguration where
  toJSON :: BodySectionConfiguration -> Value
toJSON BodySectionConfiguration' {Maybe SectionPageBreakConfiguration
Maybe SectionStyle
Text
BodySectionContent
content :: BodySectionContent
sectionId :: Text
style :: Maybe SectionStyle
pageBreakConfiguration :: Maybe SectionPageBreakConfiguration
$sel:content:BodySectionConfiguration' :: BodySectionConfiguration -> BodySectionContent
$sel:sectionId:BodySectionConfiguration' :: BodySectionConfiguration -> Text
$sel:style:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionStyle
$sel:pageBreakConfiguration:BodySectionConfiguration' :: BodySectionConfiguration -> Maybe SectionPageBreakConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"PageBreakConfiguration" 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 SectionPageBreakConfiguration
pageBreakConfiguration,
            (Key
"Style" 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 SectionStyle
style,
            forall a. a -> Maybe a
Prelude.Just (Key
"SectionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sectionId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= BodySectionContent
content)
          ]
      )