{-# 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.ConnectCases.Types.BasicLayout
-- 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.ConnectCases.Types.BasicLayout where

import Amazonka.ConnectCases.Types.LayoutSections
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

-- | Content specific to @BasicLayout@ type. It configures fields in the top
-- panel and More Info tab of agent application.
--
-- /See:/ 'newBasicLayout' smart constructor.
data BasicLayout = BasicLayout'
  { -- | This represents sections in a tab of the page layout.
    BasicLayout -> Maybe LayoutSections
moreInfo :: Prelude.Maybe LayoutSections,
    -- | This represents sections in a panel of the page layout.
    BasicLayout -> Maybe LayoutSections
topPanel :: Prelude.Maybe LayoutSections
  }
  deriving (BasicLayout -> BasicLayout -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BasicLayout -> BasicLayout -> Bool
$c/= :: BasicLayout -> BasicLayout -> Bool
== :: BasicLayout -> BasicLayout -> Bool
$c== :: BasicLayout -> BasicLayout -> Bool
Prelude.Eq, ReadPrec [BasicLayout]
ReadPrec BasicLayout
Int -> ReadS BasicLayout
ReadS [BasicLayout]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BasicLayout]
$creadListPrec :: ReadPrec [BasicLayout]
readPrec :: ReadPrec BasicLayout
$creadPrec :: ReadPrec BasicLayout
readList :: ReadS [BasicLayout]
$creadList :: ReadS [BasicLayout]
readsPrec :: Int -> ReadS BasicLayout
$creadsPrec :: Int -> ReadS BasicLayout
Prelude.Read, Int -> BasicLayout -> ShowS
[BasicLayout] -> ShowS
BasicLayout -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BasicLayout] -> ShowS
$cshowList :: [BasicLayout] -> ShowS
show :: BasicLayout -> String
$cshow :: BasicLayout -> String
showsPrec :: Int -> BasicLayout -> ShowS
$cshowsPrec :: Int -> BasicLayout -> ShowS
Prelude.Show, forall x. Rep BasicLayout x -> BasicLayout
forall x. BasicLayout -> Rep BasicLayout x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BasicLayout x -> BasicLayout
$cfrom :: forall x. BasicLayout -> Rep BasicLayout x
Prelude.Generic)

-- |
-- Create a value of 'BasicLayout' 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:
--
-- 'moreInfo', 'basicLayout_moreInfo' - This represents sections in a tab of the page layout.
--
-- 'topPanel', 'basicLayout_topPanel' - This represents sections in a panel of the page layout.
newBasicLayout ::
  BasicLayout
newBasicLayout :: BasicLayout
newBasicLayout =
  BasicLayout'
    { $sel:moreInfo:BasicLayout' :: Maybe LayoutSections
moreInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:topPanel:BasicLayout' :: Maybe LayoutSections
topPanel = forall a. Maybe a
Prelude.Nothing
    }

-- | This represents sections in a tab of the page layout.
basicLayout_moreInfo :: Lens.Lens' BasicLayout (Prelude.Maybe LayoutSections)
basicLayout_moreInfo :: Lens' BasicLayout (Maybe LayoutSections)
basicLayout_moreInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BasicLayout' {Maybe LayoutSections
moreInfo :: Maybe LayoutSections
$sel:moreInfo:BasicLayout' :: BasicLayout -> Maybe LayoutSections
moreInfo} -> Maybe LayoutSections
moreInfo) (\s :: BasicLayout
s@BasicLayout' {} Maybe LayoutSections
a -> BasicLayout
s {$sel:moreInfo:BasicLayout' :: Maybe LayoutSections
moreInfo = Maybe LayoutSections
a} :: BasicLayout)

-- | This represents sections in a panel of the page layout.
basicLayout_topPanel :: Lens.Lens' BasicLayout (Prelude.Maybe LayoutSections)
basicLayout_topPanel :: Lens' BasicLayout (Maybe LayoutSections)
basicLayout_topPanel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BasicLayout' {Maybe LayoutSections
topPanel :: Maybe LayoutSections
$sel:topPanel:BasicLayout' :: BasicLayout -> Maybe LayoutSections
topPanel} -> Maybe LayoutSections
topPanel) (\s :: BasicLayout
s@BasicLayout' {} Maybe LayoutSections
a -> BasicLayout
s {$sel:topPanel:BasicLayout' :: Maybe LayoutSections
topPanel = Maybe LayoutSections
a} :: BasicLayout)

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

instance Prelude.Hashable BasicLayout where
  hashWithSalt :: Int -> BasicLayout -> Int
hashWithSalt Int
_salt BasicLayout' {Maybe LayoutSections
topPanel :: Maybe LayoutSections
moreInfo :: Maybe LayoutSections
$sel:topPanel:BasicLayout' :: BasicLayout -> Maybe LayoutSections
$sel:moreInfo:BasicLayout' :: BasicLayout -> Maybe LayoutSections
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LayoutSections
moreInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LayoutSections
topPanel

instance Prelude.NFData BasicLayout where
  rnf :: BasicLayout -> ()
rnf BasicLayout' {Maybe LayoutSections
topPanel :: Maybe LayoutSections
moreInfo :: Maybe LayoutSections
$sel:topPanel:BasicLayout' :: BasicLayout -> Maybe LayoutSections
$sel:moreInfo:BasicLayout' :: BasicLayout -> Maybe LayoutSections
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LayoutSections
moreInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LayoutSections
topPanel

instance Data.ToJSON BasicLayout where
  toJSON :: BasicLayout -> Value
toJSON BasicLayout' {Maybe LayoutSections
topPanel :: Maybe LayoutSections
moreInfo :: Maybe LayoutSections
$sel:topPanel:BasicLayout' :: BasicLayout -> Maybe LayoutSections
$sel:moreInfo:BasicLayout' :: BasicLayout -> Maybe LayoutSections
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"moreInfo" 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 LayoutSections
moreInfo,
            (Key
"topPanel" 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 LayoutSections
topPanel
          ]
      )