{-# 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.SectionBasedLayoutConfiguration
-- 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.SectionBasedLayoutConfiguration 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.BodySectionConfiguration
import Amazonka.QuickSight.Types.HeaderFooterSectionConfiguration
import Amazonka.QuickSight.Types.SectionBasedLayoutCanvasSizeOptions

-- | The configuration for a section-based layout.
--
-- /See:/ 'newSectionBasedLayoutConfiguration' smart constructor.
data SectionBasedLayoutConfiguration = SectionBasedLayoutConfiguration'
  { -- | A list of header section configurations.
    SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
headerSections :: [HeaderFooterSectionConfiguration],
    -- | A list of body section configurations.
    SectionBasedLayoutConfiguration -> [BodySectionConfiguration]
bodySections :: [BodySectionConfiguration],
    -- | A list of footer section configurations.
    SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
footerSections :: [HeaderFooterSectionConfiguration],
    -- | The options for the canvas of a section-based layout.
    SectionBasedLayoutConfiguration
-> SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions :: SectionBasedLayoutCanvasSizeOptions
  }
  deriving (SectionBasedLayoutConfiguration
-> SectionBasedLayoutConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutConfiguration -> Bool
$c/= :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutConfiguration -> Bool
== :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutConfiguration -> Bool
$c== :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutConfiguration -> Bool
Prelude.Eq, Int -> SectionBasedLayoutConfiguration -> ShowS
[SectionBasedLayoutConfiguration] -> ShowS
SectionBasedLayoutConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SectionBasedLayoutConfiguration] -> ShowS
$cshowList :: [SectionBasedLayoutConfiguration] -> ShowS
show :: SectionBasedLayoutConfiguration -> String
$cshow :: SectionBasedLayoutConfiguration -> String
showsPrec :: Int -> SectionBasedLayoutConfiguration -> ShowS
$cshowsPrec :: Int -> SectionBasedLayoutConfiguration -> ShowS
Prelude.Show, forall x.
Rep SectionBasedLayoutConfiguration x
-> SectionBasedLayoutConfiguration
forall x.
SectionBasedLayoutConfiguration
-> Rep SectionBasedLayoutConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SectionBasedLayoutConfiguration x
-> SectionBasedLayoutConfiguration
$cfrom :: forall x.
SectionBasedLayoutConfiguration
-> Rep SectionBasedLayoutConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SectionBasedLayoutConfiguration' 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:
--
-- 'headerSections', 'sectionBasedLayoutConfiguration_headerSections' - A list of header section configurations.
--
-- 'bodySections', 'sectionBasedLayoutConfiguration_bodySections' - A list of body section configurations.
--
-- 'footerSections', 'sectionBasedLayoutConfiguration_footerSections' - A list of footer section configurations.
--
-- 'canvasSizeOptions', 'sectionBasedLayoutConfiguration_canvasSizeOptions' - The options for the canvas of a section-based layout.
newSectionBasedLayoutConfiguration ::
  -- | 'canvasSizeOptions'
  SectionBasedLayoutCanvasSizeOptions ->
  SectionBasedLayoutConfiguration
newSectionBasedLayoutConfiguration :: SectionBasedLayoutCanvasSizeOptions
-> SectionBasedLayoutConfiguration
newSectionBasedLayoutConfiguration
  SectionBasedLayoutCanvasSizeOptions
pCanvasSizeOptions_ =
    SectionBasedLayoutConfiguration'
      { $sel:headerSections:SectionBasedLayoutConfiguration' :: [HeaderFooterSectionConfiguration]
headerSections =
          forall a. Monoid a => a
Prelude.mempty,
        $sel:bodySections:SectionBasedLayoutConfiguration' :: [BodySectionConfiguration]
bodySections = forall a. Monoid a => a
Prelude.mempty,
        $sel:footerSections:SectionBasedLayoutConfiguration' :: [HeaderFooterSectionConfiguration]
footerSections = forall a. Monoid a => a
Prelude.mempty,
        $sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions = SectionBasedLayoutCanvasSizeOptions
pCanvasSizeOptions_
      }

-- | A list of header section configurations.
sectionBasedLayoutConfiguration_headerSections :: Lens.Lens' SectionBasedLayoutConfiguration [HeaderFooterSectionConfiguration]
sectionBasedLayoutConfiguration_headerSections :: Lens'
  SectionBasedLayoutConfiguration [HeaderFooterSectionConfiguration]
sectionBasedLayoutConfiguration_headerSections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionBasedLayoutConfiguration' {[HeaderFooterSectionConfiguration]
headerSections :: [HeaderFooterSectionConfiguration]
$sel:headerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
headerSections} -> [HeaderFooterSectionConfiguration]
headerSections) (\s :: SectionBasedLayoutConfiguration
s@SectionBasedLayoutConfiguration' {} [HeaderFooterSectionConfiguration]
a -> SectionBasedLayoutConfiguration
s {$sel:headerSections:SectionBasedLayoutConfiguration' :: [HeaderFooterSectionConfiguration]
headerSections = [HeaderFooterSectionConfiguration]
a} :: SectionBasedLayoutConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of body section configurations.
sectionBasedLayoutConfiguration_bodySections :: Lens.Lens' SectionBasedLayoutConfiguration [BodySectionConfiguration]
sectionBasedLayoutConfiguration_bodySections :: Lens' SectionBasedLayoutConfiguration [BodySectionConfiguration]
sectionBasedLayoutConfiguration_bodySections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionBasedLayoutConfiguration' {[BodySectionConfiguration]
bodySections :: [BodySectionConfiguration]
$sel:bodySections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration -> [BodySectionConfiguration]
bodySections} -> [BodySectionConfiguration]
bodySections) (\s :: SectionBasedLayoutConfiguration
s@SectionBasedLayoutConfiguration' {} [BodySectionConfiguration]
a -> SectionBasedLayoutConfiguration
s {$sel:bodySections:SectionBasedLayoutConfiguration' :: [BodySectionConfiguration]
bodySections = [BodySectionConfiguration]
a} :: SectionBasedLayoutConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of footer section configurations.
sectionBasedLayoutConfiguration_footerSections :: Lens.Lens' SectionBasedLayoutConfiguration [HeaderFooterSectionConfiguration]
sectionBasedLayoutConfiguration_footerSections :: Lens'
  SectionBasedLayoutConfiguration [HeaderFooterSectionConfiguration]
sectionBasedLayoutConfiguration_footerSections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionBasedLayoutConfiguration' {[HeaderFooterSectionConfiguration]
footerSections :: [HeaderFooterSectionConfiguration]
$sel:footerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
footerSections} -> [HeaderFooterSectionConfiguration]
footerSections) (\s :: SectionBasedLayoutConfiguration
s@SectionBasedLayoutConfiguration' {} [HeaderFooterSectionConfiguration]
a -> SectionBasedLayoutConfiguration
s {$sel:footerSections:SectionBasedLayoutConfiguration' :: [HeaderFooterSectionConfiguration]
footerSections = [HeaderFooterSectionConfiguration]
a} :: SectionBasedLayoutConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The options for the canvas of a section-based layout.
sectionBasedLayoutConfiguration_canvasSizeOptions :: Lens.Lens' SectionBasedLayoutConfiguration SectionBasedLayoutCanvasSizeOptions
sectionBasedLayoutConfiguration_canvasSizeOptions :: Lens'
  SectionBasedLayoutConfiguration SectionBasedLayoutCanvasSizeOptions
sectionBasedLayoutConfiguration_canvasSizeOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionBasedLayoutConfiguration' {SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions :: SectionBasedLayoutCanvasSizeOptions
$sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions} -> SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions) (\s :: SectionBasedLayoutConfiguration
s@SectionBasedLayoutConfiguration' {} SectionBasedLayoutCanvasSizeOptions
a -> SectionBasedLayoutConfiguration
s {$sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions = SectionBasedLayoutCanvasSizeOptions
a} :: SectionBasedLayoutConfiguration)

instance
  Data.FromJSON
    SectionBasedLayoutConfiguration
  where
  parseJSON :: Value -> Parser SectionBasedLayoutConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SectionBasedLayoutConfiguration"
      ( \Object
x ->
          [HeaderFooterSectionConfiguration]
-> [BodySectionConfiguration]
-> [HeaderFooterSectionConfiguration]
-> SectionBasedLayoutCanvasSizeOptions
-> SectionBasedLayoutConfiguration
SectionBasedLayoutConfiguration'
            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
"HeaderSections" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"BodySections" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"FooterSections" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"CanvasSizeOptions")
      )

instance
  Prelude.Hashable
    SectionBasedLayoutConfiguration
  where
  hashWithSalt :: Int -> SectionBasedLayoutConfiguration -> Int
hashWithSalt
    Int
_salt
    SectionBasedLayoutConfiguration' {[HeaderFooterSectionConfiguration]
[BodySectionConfiguration]
SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions :: SectionBasedLayoutCanvasSizeOptions
footerSections :: [HeaderFooterSectionConfiguration]
bodySections :: [BodySectionConfiguration]
headerSections :: [HeaderFooterSectionConfiguration]
$sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutCanvasSizeOptions
$sel:footerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
$sel:bodySections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration -> [BodySectionConfiguration]
$sel:headerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [HeaderFooterSectionConfiguration]
headerSections
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [BodySectionConfiguration]
bodySections
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [HeaderFooterSectionConfiguration]
footerSections
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions

instance
  Prelude.NFData
    SectionBasedLayoutConfiguration
  where
  rnf :: SectionBasedLayoutConfiguration -> ()
rnf SectionBasedLayoutConfiguration' {[HeaderFooterSectionConfiguration]
[BodySectionConfiguration]
SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions :: SectionBasedLayoutCanvasSizeOptions
footerSections :: [HeaderFooterSectionConfiguration]
bodySections :: [BodySectionConfiguration]
headerSections :: [HeaderFooterSectionConfiguration]
$sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutCanvasSizeOptions
$sel:footerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
$sel:bodySections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration -> [BodySectionConfiguration]
$sel:headerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [HeaderFooterSectionConfiguration]
headerSections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BodySectionConfiguration]
bodySections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [HeaderFooterSectionConfiguration]
footerSections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions

instance Data.ToJSON SectionBasedLayoutConfiguration where
  toJSON :: SectionBasedLayoutConfiguration -> Value
toJSON SectionBasedLayoutConfiguration' {[HeaderFooterSectionConfiguration]
[BodySectionConfiguration]
SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions :: SectionBasedLayoutCanvasSizeOptions
footerSections :: [HeaderFooterSectionConfiguration]
bodySections :: [BodySectionConfiguration]
headerSections :: [HeaderFooterSectionConfiguration]
$sel:canvasSizeOptions:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> SectionBasedLayoutCanvasSizeOptions
$sel:footerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
$sel:bodySections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration -> [BodySectionConfiguration]
$sel:headerSections:SectionBasedLayoutConfiguration' :: SectionBasedLayoutConfiguration
-> [HeaderFooterSectionConfiguration]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"HeaderSections" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [HeaderFooterSectionConfiguration]
headerSections),
            forall a. a -> Maybe a
Prelude.Just (Key
"BodySections" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [BodySectionConfiguration]
bodySections),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FooterSections" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [HeaderFooterSectionConfiguration]
footerSections),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"CanvasSizeOptions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SectionBasedLayoutCanvasSizeOptions
canvasSizeOptions)
          ]
      )