{-# 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.BodySectionContent
-- 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.BodySectionContent 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

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

-- |
-- Create a value of 'BodySectionContent' 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:
--
-- 'layout', 'bodySectionContent_layout' - The layout configuration of a body section.
newBodySectionContent ::
  BodySectionContent
newBodySectionContent :: BodySectionContent
newBodySectionContent =
  BodySectionContent' {$sel:layout:BodySectionContent' :: Maybe SectionLayoutConfiguration
layout = forall a. Maybe a
Prelude.Nothing}

-- | The layout configuration of a body section.
bodySectionContent_layout :: Lens.Lens' BodySectionContent (Prelude.Maybe SectionLayoutConfiguration)
bodySectionContent_layout :: Lens' BodySectionContent (Maybe SectionLayoutConfiguration)
bodySectionContent_layout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BodySectionContent' {Maybe SectionLayoutConfiguration
layout :: Maybe SectionLayoutConfiguration
$sel:layout:BodySectionContent' :: BodySectionContent -> Maybe SectionLayoutConfiguration
layout} -> Maybe SectionLayoutConfiguration
layout) (\s :: BodySectionContent
s@BodySectionContent' {} Maybe SectionLayoutConfiguration
a -> BodySectionContent
s {$sel:layout:BodySectionContent' :: Maybe SectionLayoutConfiguration
layout = Maybe SectionLayoutConfiguration
a} :: BodySectionContent)

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

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

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

instance Data.ToJSON BodySectionContent where
  toJSON :: BodySectionContent -> Value
toJSON BodySectionContent' {Maybe SectionLayoutConfiguration
layout :: Maybe SectionLayoutConfiguration
$sel:layout:BodySectionContent' :: BodySectionContent -> Maybe SectionLayoutConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Layout" 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 SectionLayoutConfiguration
layout]
      )