{-# 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.SheetControlLayout
-- 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.SheetControlLayout 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.SheetControlLayoutConfiguration

-- | A grid layout to define the placement of sheet control.
--
-- /See:/ 'newSheetControlLayout' smart constructor.
data SheetControlLayout = SheetControlLayout'
  { -- | The configuration that determines the elements and canvas size options
    -- of sheet control.
    SheetControlLayout -> SheetControlLayoutConfiguration
configuration :: SheetControlLayoutConfiguration
  }
  deriving (SheetControlLayout -> SheetControlLayout -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SheetControlLayout -> SheetControlLayout -> Bool
$c/= :: SheetControlLayout -> SheetControlLayout -> Bool
== :: SheetControlLayout -> SheetControlLayout -> Bool
$c== :: SheetControlLayout -> SheetControlLayout -> Bool
Prelude.Eq, ReadPrec [SheetControlLayout]
ReadPrec SheetControlLayout
Int -> ReadS SheetControlLayout
ReadS [SheetControlLayout]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SheetControlLayout]
$creadListPrec :: ReadPrec [SheetControlLayout]
readPrec :: ReadPrec SheetControlLayout
$creadPrec :: ReadPrec SheetControlLayout
readList :: ReadS [SheetControlLayout]
$creadList :: ReadS [SheetControlLayout]
readsPrec :: Int -> ReadS SheetControlLayout
$creadsPrec :: Int -> ReadS SheetControlLayout
Prelude.Read, Int -> SheetControlLayout -> ShowS
[SheetControlLayout] -> ShowS
SheetControlLayout -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SheetControlLayout] -> ShowS
$cshowList :: [SheetControlLayout] -> ShowS
show :: SheetControlLayout -> String
$cshow :: SheetControlLayout -> String
showsPrec :: Int -> SheetControlLayout -> ShowS
$cshowsPrec :: Int -> SheetControlLayout -> ShowS
Prelude.Show, forall x. Rep SheetControlLayout x -> SheetControlLayout
forall x. SheetControlLayout -> Rep SheetControlLayout x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SheetControlLayout x -> SheetControlLayout
$cfrom :: forall x. SheetControlLayout -> Rep SheetControlLayout x
Prelude.Generic)

-- |
-- Create a value of 'SheetControlLayout' 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:
--
-- 'configuration', 'sheetControlLayout_configuration' - The configuration that determines the elements and canvas size options
-- of sheet control.
newSheetControlLayout ::
  -- | 'configuration'
  SheetControlLayoutConfiguration ->
  SheetControlLayout
newSheetControlLayout :: SheetControlLayoutConfiguration -> SheetControlLayout
newSheetControlLayout SheetControlLayoutConfiguration
pConfiguration_ =
  SheetControlLayout'
    { $sel:configuration:SheetControlLayout' :: SheetControlLayoutConfiguration
configuration =
        SheetControlLayoutConfiguration
pConfiguration_
    }

-- | The configuration that determines the elements and canvas size options
-- of sheet control.
sheetControlLayout_configuration :: Lens.Lens' SheetControlLayout SheetControlLayoutConfiguration
sheetControlLayout_configuration :: Lens' SheetControlLayout SheetControlLayoutConfiguration
sheetControlLayout_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetControlLayout' {SheetControlLayoutConfiguration
configuration :: SheetControlLayoutConfiguration
$sel:configuration:SheetControlLayout' :: SheetControlLayout -> SheetControlLayoutConfiguration
configuration} -> SheetControlLayoutConfiguration
configuration) (\s :: SheetControlLayout
s@SheetControlLayout' {} SheetControlLayoutConfiguration
a -> SheetControlLayout
s {$sel:configuration:SheetControlLayout' :: SheetControlLayoutConfiguration
configuration = SheetControlLayoutConfiguration
a} :: SheetControlLayout)

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

instance Prelude.Hashable SheetControlLayout where
  hashWithSalt :: Int -> SheetControlLayout -> Int
hashWithSalt Int
_salt SheetControlLayout' {SheetControlLayoutConfiguration
configuration :: SheetControlLayoutConfiguration
$sel:configuration:SheetControlLayout' :: SheetControlLayout -> SheetControlLayoutConfiguration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SheetControlLayoutConfiguration
configuration

instance Prelude.NFData SheetControlLayout where
  rnf :: SheetControlLayout -> ()
rnf SheetControlLayout' {SheetControlLayoutConfiguration
configuration :: SheetControlLayoutConfiguration
$sel:configuration:SheetControlLayout' :: SheetControlLayout -> SheetControlLayoutConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf SheetControlLayoutConfiguration
configuration

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