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

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

-- |
-- Create a value of 'FreeFormSectionLayoutConfiguration' 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:
--
-- 'elements', 'freeFormSectionLayoutConfiguration_elements' - The elements that are included in the free-form layout.
newFreeFormSectionLayoutConfiguration ::
  FreeFormSectionLayoutConfiguration
newFreeFormSectionLayoutConfiguration :: FreeFormSectionLayoutConfiguration
newFreeFormSectionLayoutConfiguration =
  FreeFormSectionLayoutConfiguration'
    { $sel:elements:FreeFormSectionLayoutConfiguration' :: [FreeFormLayoutElement]
elements =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | The elements that are included in the free-form layout.
freeFormSectionLayoutConfiguration_elements :: Lens.Lens' FreeFormSectionLayoutConfiguration [FreeFormLayoutElement]
freeFormSectionLayoutConfiguration_elements :: Lens' FreeFormSectionLayoutConfiguration [FreeFormLayoutElement]
freeFormSectionLayoutConfiguration_elements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeFormSectionLayoutConfiguration' {[FreeFormLayoutElement]
elements :: [FreeFormLayoutElement]
$sel:elements:FreeFormSectionLayoutConfiguration' :: FreeFormSectionLayoutConfiguration -> [FreeFormLayoutElement]
elements} -> [FreeFormLayoutElement]
elements) (\s :: FreeFormSectionLayoutConfiguration
s@FreeFormSectionLayoutConfiguration' {} [FreeFormLayoutElement]
a -> FreeFormSectionLayoutConfiguration
s {$sel:elements:FreeFormSectionLayoutConfiguration' :: [FreeFormLayoutElement]
elements = [FreeFormLayoutElement]
a} :: FreeFormSectionLayoutConfiguration) 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

instance
  Data.FromJSON
    FreeFormSectionLayoutConfiguration
  where
  parseJSON :: Value -> Parser FreeFormSectionLayoutConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FreeFormSectionLayoutConfiguration"
      ( \Object
x ->
          [FreeFormLayoutElement] -> FreeFormSectionLayoutConfiguration
FreeFormSectionLayoutConfiguration'
            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
"Elements" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    FreeFormSectionLayoutConfiguration
  where
  hashWithSalt :: Int -> FreeFormSectionLayoutConfiguration -> Int
hashWithSalt
    Int
_salt
    FreeFormSectionLayoutConfiguration' {[FreeFormLayoutElement]
elements :: [FreeFormLayoutElement]
$sel:elements:FreeFormSectionLayoutConfiguration' :: FreeFormSectionLayoutConfiguration -> [FreeFormLayoutElement]
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [FreeFormLayoutElement]
elements

instance
  Prelude.NFData
    FreeFormSectionLayoutConfiguration
  where
  rnf :: FreeFormSectionLayoutConfiguration -> ()
rnf FreeFormSectionLayoutConfiguration' {[FreeFormLayoutElement]
elements :: [FreeFormLayoutElement]
$sel:elements:FreeFormSectionLayoutConfiguration' :: FreeFormSectionLayoutConfiguration -> [FreeFormLayoutElement]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [FreeFormLayoutElement]
elements

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