{-# 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.HeaderFooterSectionConfiguration
-- 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.HeaderFooterSectionConfiguration 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.SectionLayoutConfiguration
import Amazonka.QuickSight.Types.SectionStyle

-- | The configuration of a header or footer section.
--
-- /See:/ 'newHeaderFooterSectionConfiguration' smart constructor.
data HeaderFooterSectionConfiguration = HeaderFooterSectionConfiguration'
  { -- | The style options of a header or footer section.
    HeaderFooterSectionConfiguration -> Maybe SectionStyle
style :: Prelude.Maybe SectionStyle,
    -- | The unique identifier of the header or footer section.
    HeaderFooterSectionConfiguration -> Text
sectionId :: Prelude.Text,
    -- | The layout configuration of the header or footer section.
    HeaderFooterSectionConfiguration -> SectionLayoutConfiguration
layout :: SectionLayoutConfiguration
  }
  deriving (HeaderFooterSectionConfiguration
-> HeaderFooterSectionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderFooterSectionConfiguration
-> HeaderFooterSectionConfiguration -> Bool
$c/= :: HeaderFooterSectionConfiguration
-> HeaderFooterSectionConfiguration -> Bool
== :: HeaderFooterSectionConfiguration
-> HeaderFooterSectionConfiguration -> Bool
$c== :: HeaderFooterSectionConfiguration
-> HeaderFooterSectionConfiguration -> Bool
Prelude.Eq, Int -> HeaderFooterSectionConfiguration -> ShowS
[HeaderFooterSectionConfiguration] -> ShowS
HeaderFooterSectionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderFooterSectionConfiguration] -> ShowS
$cshowList :: [HeaderFooterSectionConfiguration] -> ShowS
show :: HeaderFooterSectionConfiguration -> String
$cshow :: HeaderFooterSectionConfiguration -> String
showsPrec :: Int -> HeaderFooterSectionConfiguration -> ShowS
$cshowsPrec :: Int -> HeaderFooterSectionConfiguration -> ShowS
Prelude.Show, forall x.
Rep HeaderFooterSectionConfiguration x
-> HeaderFooterSectionConfiguration
forall x.
HeaderFooterSectionConfiguration
-> Rep HeaderFooterSectionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HeaderFooterSectionConfiguration x
-> HeaderFooterSectionConfiguration
$cfrom :: forall x.
HeaderFooterSectionConfiguration
-> Rep HeaderFooterSectionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'HeaderFooterSectionConfiguration' 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:
--
-- 'style', 'headerFooterSectionConfiguration_style' - The style options of a header or footer section.
--
-- 'sectionId', 'headerFooterSectionConfiguration_sectionId' - The unique identifier of the header or footer section.
--
-- 'layout', 'headerFooterSectionConfiguration_layout' - The layout configuration of the header or footer section.
newHeaderFooterSectionConfiguration ::
  -- | 'sectionId'
  Prelude.Text ->
  -- | 'layout'
  SectionLayoutConfiguration ->
  HeaderFooterSectionConfiguration
newHeaderFooterSectionConfiguration :: Text
-> SectionLayoutConfiguration -> HeaderFooterSectionConfiguration
newHeaderFooterSectionConfiguration
  Text
pSectionId_
  SectionLayoutConfiguration
pLayout_ =
    HeaderFooterSectionConfiguration'
      { $sel:style:HeaderFooterSectionConfiguration' :: Maybe SectionStyle
style =
          forall a. Maybe a
Prelude.Nothing,
        $sel:sectionId:HeaderFooterSectionConfiguration' :: Text
sectionId = Text
pSectionId_,
        $sel:layout:HeaderFooterSectionConfiguration' :: SectionLayoutConfiguration
layout = SectionLayoutConfiguration
pLayout_
      }

-- | The style options of a header or footer section.
headerFooterSectionConfiguration_style :: Lens.Lens' HeaderFooterSectionConfiguration (Prelude.Maybe SectionStyle)
headerFooterSectionConfiguration_style :: Lens' HeaderFooterSectionConfiguration (Maybe SectionStyle)
headerFooterSectionConfiguration_style = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeaderFooterSectionConfiguration' {Maybe SectionStyle
style :: Maybe SectionStyle
$sel:style:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Maybe SectionStyle
style} -> Maybe SectionStyle
style) (\s :: HeaderFooterSectionConfiguration
s@HeaderFooterSectionConfiguration' {} Maybe SectionStyle
a -> HeaderFooterSectionConfiguration
s {$sel:style:HeaderFooterSectionConfiguration' :: Maybe SectionStyle
style = Maybe SectionStyle
a} :: HeaderFooterSectionConfiguration)

-- | The unique identifier of the header or footer section.
headerFooterSectionConfiguration_sectionId :: Lens.Lens' HeaderFooterSectionConfiguration Prelude.Text
headerFooterSectionConfiguration_sectionId :: Lens' HeaderFooterSectionConfiguration Text
headerFooterSectionConfiguration_sectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeaderFooterSectionConfiguration' {Text
sectionId :: Text
$sel:sectionId:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Text
sectionId} -> Text
sectionId) (\s :: HeaderFooterSectionConfiguration
s@HeaderFooterSectionConfiguration' {} Text
a -> HeaderFooterSectionConfiguration
s {$sel:sectionId:HeaderFooterSectionConfiguration' :: Text
sectionId = Text
a} :: HeaderFooterSectionConfiguration)

-- | The layout configuration of the header or footer section.
headerFooterSectionConfiguration_layout :: Lens.Lens' HeaderFooterSectionConfiguration SectionLayoutConfiguration
headerFooterSectionConfiguration_layout :: Lens' HeaderFooterSectionConfiguration SectionLayoutConfiguration
headerFooterSectionConfiguration_layout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeaderFooterSectionConfiguration' {SectionLayoutConfiguration
layout :: SectionLayoutConfiguration
$sel:layout:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> SectionLayoutConfiguration
layout} -> SectionLayoutConfiguration
layout) (\s :: HeaderFooterSectionConfiguration
s@HeaderFooterSectionConfiguration' {} SectionLayoutConfiguration
a -> HeaderFooterSectionConfiguration
s {$sel:layout:HeaderFooterSectionConfiguration' :: SectionLayoutConfiguration
layout = SectionLayoutConfiguration
a} :: HeaderFooterSectionConfiguration)

instance
  Data.FromJSON
    HeaderFooterSectionConfiguration
  where
  parseJSON :: Value -> Parser HeaderFooterSectionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HeaderFooterSectionConfiguration"
      ( \Object
x ->
          Maybe SectionStyle
-> Text
-> SectionLayoutConfiguration
-> HeaderFooterSectionConfiguration
HeaderFooterSectionConfiguration'
            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
"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
"Layout")
      )

instance
  Prelude.Hashable
    HeaderFooterSectionConfiguration
  where
  hashWithSalt :: Int -> HeaderFooterSectionConfiguration -> Int
hashWithSalt
    Int
_salt
    HeaderFooterSectionConfiguration' {Maybe SectionStyle
Text
SectionLayoutConfiguration
layout :: SectionLayoutConfiguration
sectionId :: Text
style :: Maybe SectionStyle
$sel:layout:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> SectionLayoutConfiguration
$sel:sectionId:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Text
$sel:style:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Maybe SectionStyle
..} =
      Int
_salt
        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` SectionLayoutConfiguration
layout

instance
  Prelude.NFData
    HeaderFooterSectionConfiguration
  where
  rnf :: HeaderFooterSectionConfiguration -> ()
rnf HeaderFooterSectionConfiguration' {Maybe SectionStyle
Text
SectionLayoutConfiguration
layout :: SectionLayoutConfiguration
sectionId :: Text
style :: Maybe SectionStyle
$sel:layout:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> SectionLayoutConfiguration
$sel:sectionId:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Text
$sel:style:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Maybe SectionStyle
..} =
    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 SectionLayoutConfiguration
layout

instance Data.ToJSON HeaderFooterSectionConfiguration where
  toJSON :: HeaderFooterSectionConfiguration -> Value
toJSON HeaderFooterSectionConfiguration' {Maybe SectionStyle
Text
SectionLayoutConfiguration
layout :: SectionLayoutConfiguration
sectionId :: Text
style :: Maybe SectionStyle
$sel:layout:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> SectionLayoutConfiguration
$sel:sectionId:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Text
$sel:style:HeaderFooterSectionConfiguration' :: HeaderFooterSectionConfiguration -> Maybe SectionStyle
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Layout" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SectionLayoutConfiguration
layout)
          ]
      )