{-# 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.MarginStyle
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.MarginStyle where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The display options for margins around the outside edge of sheets.
--
-- /See:/ 'newMarginStyle' smart constructor.
data MarginStyle = MarginStyle'
  { -- | This Boolean value controls whether to display sheet margins.
    MarginStyle -> Maybe Bool
show :: Prelude.Maybe Prelude.Bool
  }
  deriving (MarginStyle -> MarginStyle -> Bool
(MarginStyle -> MarginStyle -> Bool)
-> (MarginStyle -> MarginStyle -> Bool) -> Eq MarginStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MarginStyle -> MarginStyle -> Bool
$c/= :: MarginStyle -> MarginStyle -> Bool
== :: MarginStyle -> MarginStyle -> Bool
$c== :: MarginStyle -> MarginStyle -> Bool
Prelude.Eq, ReadPrec [MarginStyle]
ReadPrec MarginStyle
Int -> ReadS MarginStyle
ReadS [MarginStyle]
(Int -> ReadS MarginStyle)
-> ReadS [MarginStyle]
-> ReadPrec MarginStyle
-> ReadPrec [MarginStyle]
-> Read MarginStyle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MarginStyle]
$creadListPrec :: ReadPrec [MarginStyle]
readPrec :: ReadPrec MarginStyle
$creadPrec :: ReadPrec MarginStyle
readList :: ReadS [MarginStyle]
$creadList :: ReadS [MarginStyle]
readsPrec :: Int -> ReadS MarginStyle
$creadsPrec :: Int -> ReadS MarginStyle
Prelude.Read, Int -> MarginStyle -> ShowS
[MarginStyle] -> ShowS
MarginStyle -> String
(Int -> MarginStyle -> ShowS)
-> (MarginStyle -> String)
-> ([MarginStyle] -> ShowS)
-> Show MarginStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MarginStyle] -> ShowS
$cshowList :: [MarginStyle] -> ShowS
show :: MarginStyle -> String
$cshow :: MarginStyle -> String
showsPrec :: Int -> MarginStyle -> ShowS
$cshowsPrec :: Int -> MarginStyle -> ShowS
Prelude.Show, (forall x. MarginStyle -> Rep MarginStyle x)
-> (forall x. Rep MarginStyle x -> MarginStyle)
-> Generic MarginStyle
forall x. Rep MarginStyle x -> MarginStyle
forall x. MarginStyle -> Rep MarginStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MarginStyle x -> MarginStyle
$cfrom :: forall x. MarginStyle -> Rep MarginStyle x
Prelude.Generic)

-- |
-- Create a value of 'MarginStyle' 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:
--
-- 'show', 'marginStyle_show' - This Boolean value controls whether to display sheet margins.
newMarginStyle ::
  MarginStyle
newMarginStyle :: MarginStyle
newMarginStyle = MarginStyle' :: Maybe Bool -> MarginStyle
MarginStyle' {$sel:show:MarginStyle' :: Maybe Bool
show = Maybe Bool
forall a. Maybe a
Prelude.Nothing}

-- | This Boolean value controls whether to display sheet margins.
marginStyle_show :: Lens.Lens' MarginStyle (Prelude.Maybe Prelude.Bool)
marginStyle_show :: (Maybe Bool -> f (Maybe Bool)) -> MarginStyle -> f MarginStyle
marginStyle_show = (MarginStyle -> Maybe Bool)
-> (MarginStyle -> Maybe Bool -> MarginStyle)
-> Lens MarginStyle MarginStyle (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MarginStyle' {Maybe Bool
show :: Maybe Bool
$sel:show:MarginStyle' :: MarginStyle -> Maybe Bool
show} -> Maybe Bool
show) (\s :: MarginStyle
s@MarginStyle' {} Maybe Bool
a -> MarginStyle
s {$sel:show:MarginStyle' :: Maybe Bool
show = Maybe Bool
a} :: MarginStyle)

instance Core.FromJSON MarginStyle where
  parseJSON :: Value -> Parser MarginStyle
parseJSON =
    String
-> (Object -> Parser MarginStyle) -> Value -> Parser MarginStyle
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MarginStyle"
      (\Object
x -> Maybe Bool -> MarginStyle
MarginStyle' (Maybe Bool -> MarginStyle)
-> Parser (Maybe Bool) -> Parser MarginStyle
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Show"))

instance Prelude.Hashable MarginStyle

instance Prelude.NFData MarginStyle

instance Core.ToJSON MarginStyle where
  toJSON :: MarginStyle -> Value
toJSON MarginStyle' {Maybe Bool
show :: Maybe Bool
$sel:show:MarginStyle' :: MarginStyle -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Show" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
show]
      )