{-# 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.TileLayoutStyle
-- 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.TileLayoutStyle 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.GutterStyle
import Amazonka.QuickSight.Types.MarginStyle

-- | The display options for the layout of tiles on a sheet.
--
-- /See:/ 'newTileLayoutStyle' smart constructor.
data TileLayoutStyle = TileLayoutStyle'
  { -- | The gutter settings that apply between tiles.
    TileLayoutStyle -> Maybe GutterStyle
gutter :: Prelude.Maybe GutterStyle,
    -- | The margin settings that apply around the outside edge of sheets.
    TileLayoutStyle -> Maybe MarginStyle
margin :: Prelude.Maybe MarginStyle
  }
  deriving (TileLayoutStyle -> TileLayoutStyle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TileLayoutStyle -> TileLayoutStyle -> Bool
$c/= :: TileLayoutStyle -> TileLayoutStyle -> Bool
== :: TileLayoutStyle -> TileLayoutStyle -> Bool
$c== :: TileLayoutStyle -> TileLayoutStyle -> Bool
Prelude.Eq, ReadPrec [TileLayoutStyle]
ReadPrec TileLayoutStyle
Int -> ReadS TileLayoutStyle
ReadS [TileLayoutStyle]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TileLayoutStyle]
$creadListPrec :: ReadPrec [TileLayoutStyle]
readPrec :: ReadPrec TileLayoutStyle
$creadPrec :: ReadPrec TileLayoutStyle
readList :: ReadS [TileLayoutStyle]
$creadList :: ReadS [TileLayoutStyle]
readsPrec :: Int -> ReadS TileLayoutStyle
$creadsPrec :: Int -> ReadS TileLayoutStyle
Prelude.Read, Int -> TileLayoutStyle -> ShowS
[TileLayoutStyle] -> ShowS
TileLayoutStyle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TileLayoutStyle] -> ShowS
$cshowList :: [TileLayoutStyle] -> ShowS
show :: TileLayoutStyle -> String
$cshow :: TileLayoutStyle -> String
showsPrec :: Int -> TileLayoutStyle -> ShowS
$cshowsPrec :: Int -> TileLayoutStyle -> ShowS
Prelude.Show, forall x. Rep TileLayoutStyle x -> TileLayoutStyle
forall x. TileLayoutStyle -> Rep TileLayoutStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TileLayoutStyle x -> TileLayoutStyle
$cfrom :: forall x. TileLayoutStyle -> Rep TileLayoutStyle x
Prelude.Generic)

-- |
-- Create a value of 'TileLayoutStyle' 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:
--
-- 'gutter', 'tileLayoutStyle_gutter' - The gutter settings that apply between tiles.
--
-- 'margin', 'tileLayoutStyle_margin' - The margin settings that apply around the outside edge of sheets.
newTileLayoutStyle ::
  TileLayoutStyle
newTileLayoutStyle :: TileLayoutStyle
newTileLayoutStyle =
  TileLayoutStyle'
    { $sel:gutter:TileLayoutStyle' :: Maybe GutterStyle
gutter = forall a. Maybe a
Prelude.Nothing,
      $sel:margin:TileLayoutStyle' :: Maybe MarginStyle
margin = forall a. Maybe a
Prelude.Nothing
    }

-- | The gutter settings that apply between tiles.
tileLayoutStyle_gutter :: Lens.Lens' TileLayoutStyle (Prelude.Maybe GutterStyle)
tileLayoutStyle_gutter :: Lens' TileLayoutStyle (Maybe GutterStyle)
tileLayoutStyle_gutter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TileLayoutStyle' {Maybe GutterStyle
gutter :: Maybe GutterStyle
$sel:gutter:TileLayoutStyle' :: TileLayoutStyle -> Maybe GutterStyle
gutter} -> Maybe GutterStyle
gutter) (\s :: TileLayoutStyle
s@TileLayoutStyle' {} Maybe GutterStyle
a -> TileLayoutStyle
s {$sel:gutter:TileLayoutStyle' :: Maybe GutterStyle
gutter = Maybe GutterStyle
a} :: TileLayoutStyle)

-- | The margin settings that apply around the outside edge of sheets.
tileLayoutStyle_margin :: Lens.Lens' TileLayoutStyle (Prelude.Maybe MarginStyle)
tileLayoutStyle_margin :: Lens' TileLayoutStyle (Maybe MarginStyle)
tileLayoutStyle_margin = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TileLayoutStyle' {Maybe MarginStyle
margin :: Maybe MarginStyle
$sel:margin:TileLayoutStyle' :: TileLayoutStyle -> Maybe MarginStyle
margin} -> Maybe MarginStyle
margin) (\s :: TileLayoutStyle
s@TileLayoutStyle' {} Maybe MarginStyle
a -> TileLayoutStyle
s {$sel:margin:TileLayoutStyle' :: Maybe MarginStyle
margin = Maybe MarginStyle
a} :: TileLayoutStyle)

instance Data.FromJSON TileLayoutStyle where
  parseJSON :: Value -> Parser TileLayoutStyle
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TileLayoutStyle"
      ( \Object
x ->
          Maybe GutterStyle -> Maybe MarginStyle -> TileLayoutStyle
TileLayoutStyle'
            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
"Gutter")
            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
"Margin")
      )

instance Prelude.Hashable TileLayoutStyle where
  hashWithSalt :: Int -> TileLayoutStyle -> Int
hashWithSalt Int
_salt TileLayoutStyle' {Maybe GutterStyle
Maybe MarginStyle
margin :: Maybe MarginStyle
gutter :: Maybe GutterStyle
$sel:margin:TileLayoutStyle' :: TileLayoutStyle -> Maybe MarginStyle
$sel:gutter:TileLayoutStyle' :: TileLayoutStyle -> Maybe GutterStyle
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GutterStyle
gutter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MarginStyle
margin

instance Prelude.NFData TileLayoutStyle where
  rnf :: TileLayoutStyle -> ()
rnf TileLayoutStyle' {Maybe GutterStyle
Maybe MarginStyle
margin :: Maybe MarginStyle
gutter :: Maybe GutterStyle
$sel:margin:TileLayoutStyle' :: TileLayoutStyle -> Maybe MarginStyle
$sel:gutter:TileLayoutStyle' :: TileLayoutStyle -> Maybe GutterStyle
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GutterStyle
gutter seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MarginStyle
margin

instance Data.ToJSON TileLayoutStyle where
  toJSON :: TileLayoutStyle -> Value
toJSON TileLayoutStyle' {Maybe GutterStyle
Maybe MarginStyle
margin :: Maybe MarginStyle
gutter :: Maybe GutterStyle
$sel:margin:TileLayoutStyle' :: TileLayoutStyle -> Maybe MarginStyle
$sel:gutter:TileLayoutStyle' :: TileLayoutStyle -> Maybe GutterStyle
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Gutter" 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 GutterStyle
gutter,
            (Key
"Margin" 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 MarginStyle
margin
          ]
      )