{-# 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.SectionLayoutConfiguration
-- 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.SectionLayoutConfiguration 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.FreeFormSectionLayoutConfiguration

-- | The layout configuration of a section.
--
-- /See:/ 'newSectionLayoutConfiguration' smart constructor.
data SectionLayoutConfiguration = SectionLayoutConfiguration'
  { -- | The free-form layout configuration of a section.
    SectionLayoutConfiguration -> FreeFormSectionLayoutConfiguration
freeFormLayout :: FreeFormSectionLayoutConfiguration
  }
  deriving (SectionLayoutConfiguration -> SectionLayoutConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SectionLayoutConfiguration -> SectionLayoutConfiguration -> Bool
$c/= :: SectionLayoutConfiguration -> SectionLayoutConfiguration -> Bool
== :: SectionLayoutConfiguration -> SectionLayoutConfiguration -> Bool
$c== :: SectionLayoutConfiguration -> SectionLayoutConfiguration -> Bool
Prelude.Eq, Int -> SectionLayoutConfiguration -> ShowS
[SectionLayoutConfiguration] -> ShowS
SectionLayoutConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SectionLayoutConfiguration] -> ShowS
$cshowList :: [SectionLayoutConfiguration] -> ShowS
show :: SectionLayoutConfiguration -> String
$cshow :: SectionLayoutConfiguration -> String
showsPrec :: Int -> SectionLayoutConfiguration -> ShowS
$cshowsPrec :: Int -> SectionLayoutConfiguration -> ShowS
Prelude.Show, forall x.
Rep SectionLayoutConfiguration x -> SectionLayoutConfiguration
forall x.
SectionLayoutConfiguration -> Rep SectionLayoutConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SectionLayoutConfiguration x -> SectionLayoutConfiguration
$cfrom :: forall x.
SectionLayoutConfiguration -> Rep SectionLayoutConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SectionLayoutConfiguration' 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:
--
-- 'freeFormLayout', 'sectionLayoutConfiguration_freeFormLayout' - The free-form layout configuration of a section.
newSectionLayoutConfiguration ::
  -- | 'freeFormLayout'
  FreeFormSectionLayoutConfiguration ->
  SectionLayoutConfiguration
newSectionLayoutConfiguration :: FreeFormSectionLayoutConfiguration -> SectionLayoutConfiguration
newSectionLayoutConfiguration FreeFormSectionLayoutConfiguration
pFreeFormLayout_ =
  SectionLayoutConfiguration'
    { $sel:freeFormLayout:SectionLayoutConfiguration' :: FreeFormSectionLayoutConfiguration
freeFormLayout =
        FreeFormSectionLayoutConfiguration
pFreeFormLayout_
    }

-- | The free-form layout configuration of a section.
sectionLayoutConfiguration_freeFormLayout :: Lens.Lens' SectionLayoutConfiguration FreeFormSectionLayoutConfiguration
sectionLayoutConfiguration_freeFormLayout :: Lens' SectionLayoutConfiguration FreeFormSectionLayoutConfiguration
sectionLayoutConfiguration_freeFormLayout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionLayoutConfiguration' {FreeFormSectionLayoutConfiguration
freeFormLayout :: FreeFormSectionLayoutConfiguration
$sel:freeFormLayout:SectionLayoutConfiguration' :: SectionLayoutConfiguration -> FreeFormSectionLayoutConfiguration
freeFormLayout} -> FreeFormSectionLayoutConfiguration
freeFormLayout) (\s :: SectionLayoutConfiguration
s@SectionLayoutConfiguration' {} FreeFormSectionLayoutConfiguration
a -> SectionLayoutConfiguration
s {$sel:freeFormLayout:SectionLayoutConfiguration' :: FreeFormSectionLayoutConfiguration
freeFormLayout = FreeFormSectionLayoutConfiguration
a} :: SectionLayoutConfiguration)

instance Data.FromJSON SectionLayoutConfiguration where
  parseJSON :: Value -> Parser SectionLayoutConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SectionLayoutConfiguration"
      ( \Object
x ->
          FreeFormSectionLayoutConfiguration -> SectionLayoutConfiguration
SectionLayoutConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FreeFormLayout")
      )

instance Prelude.Hashable SectionLayoutConfiguration where
  hashWithSalt :: Int -> SectionLayoutConfiguration -> Int
hashWithSalt Int
_salt SectionLayoutConfiguration' {FreeFormSectionLayoutConfiguration
freeFormLayout :: FreeFormSectionLayoutConfiguration
$sel:freeFormLayout:SectionLayoutConfiguration' :: SectionLayoutConfiguration -> FreeFormSectionLayoutConfiguration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FreeFormSectionLayoutConfiguration
freeFormLayout

instance Prelude.NFData SectionLayoutConfiguration where
  rnf :: SectionLayoutConfiguration -> ()
rnf SectionLayoutConfiguration' {FreeFormSectionLayoutConfiguration
freeFormLayout :: FreeFormSectionLayoutConfiguration
$sel:freeFormLayout:SectionLayoutConfiguration' :: SectionLayoutConfiguration -> FreeFormSectionLayoutConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf FreeFormSectionLayoutConfiguration
freeFormLayout

instance Data.ToJSON SectionLayoutConfiguration where
  toJSON :: SectionLayoutConfiguration -> Value
toJSON SectionLayoutConfiguration' {FreeFormSectionLayoutConfiguration
freeFormLayout :: FreeFormSectionLayoutConfiguration
$sel:freeFormLayout:SectionLayoutConfiguration' :: SectionLayoutConfiguration -> FreeFormSectionLayoutConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"FreeFormLayout" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FreeFormSectionLayoutConfiguration
freeFormLayout)
          ]
      )