{-# 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.TileStyle
-- 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.TileStyle where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.BorderStyle

-- | Display options related to tiles on a sheet.
--
-- /See:/ 'newTileStyle' smart constructor.
data TileStyle = TileStyle'
  { -- | The border around a tile.
    TileStyle -> Maybe BorderStyle
border :: Prelude.Maybe BorderStyle
  }
  deriving (TileStyle -> TileStyle -> Bool
(TileStyle -> TileStyle -> Bool)
-> (TileStyle -> TileStyle -> Bool) -> Eq TileStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TileStyle -> TileStyle -> Bool
$c/= :: TileStyle -> TileStyle -> Bool
== :: TileStyle -> TileStyle -> Bool
$c== :: TileStyle -> TileStyle -> Bool
Prelude.Eq, ReadPrec [TileStyle]
ReadPrec TileStyle
Int -> ReadS TileStyle
ReadS [TileStyle]
(Int -> ReadS TileStyle)
-> ReadS [TileStyle]
-> ReadPrec TileStyle
-> ReadPrec [TileStyle]
-> Read TileStyle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TileStyle]
$creadListPrec :: ReadPrec [TileStyle]
readPrec :: ReadPrec TileStyle
$creadPrec :: ReadPrec TileStyle
readList :: ReadS [TileStyle]
$creadList :: ReadS [TileStyle]
readsPrec :: Int -> ReadS TileStyle
$creadsPrec :: Int -> ReadS TileStyle
Prelude.Read, Int -> TileStyle -> ShowS
[TileStyle] -> ShowS
TileStyle -> String
(Int -> TileStyle -> ShowS)
-> (TileStyle -> String)
-> ([TileStyle] -> ShowS)
-> Show TileStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TileStyle] -> ShowS
$cshowList :: [TileStyle] -> ShowS
show :: TileStyle -> String
$cshow :: TileStyle -> String
showsPrec :: Int -> TileStyle -> ShowS
$cshowsPrec :: Int -> TileStyle -> ShowS
Prelude.Show, (forall x. TileStyle -> Rep TileStyle x)
-> (forall x. Rep TileStyle x -> TileStyle) -> Generic TileStyle
forall x. Rep TileStyle x -> TileStyle
forall x. TileStyle -> Rep TileStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TileStyle x -> TileStyle
$cfrom :: forall x. TileStyle -> Rep TileStyle x
Prelude.Generic)

-- |
-- Create a value of 'TileStyle' 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:
--
-- 'border', 'tileStyle_border' - The border around a tile.
newTileStyle ::
  TileStyle
newTileStyle :: TileStyle
newTileStyle = TileStyle' :: Maybe BorderStyle -> TileStyle
TileStyle' {$sel:border:TileStyle' :: Maybe BorderStyle
border = Maybe BorderStyle
forall a. Maybe a
Prelude.Nothing}

-- | The border around a tile.
tileStyle_border :: Lens.Lens' TileStyle (Prelude.Maybe BorderStyle)
tileStyle_border :: (Maybe BorderStyle -> f (Maybe BorderStyle))
-> TileStyle -> f TileStyle
tileStyle_border = (TileStyle -> Maybe BorderStyle)
-> (TileStyle -> Maybe BorderStyle -> TileStyle)
-> Lens TileStyle TileStyle (Maybe BorderStyle) (Maybe BorderStyle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TileStyle' {Maybe BorderStyle
border :: Maybe BorderStyle
$sel:border:TileStyle' :: TileStyle -> Maybe BorderStyle
border} -> Maybe BorderStyle
border) (\s :: TileStyle
s@TileStyle' {} Maybe BorderStyle
a -> TileStyle
s {$sel:border:TileStyle' :: Maybe BorderStyle
border = Maybe BorderStyle
a} :: TileStyle)

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

instance Prelude.Hashable TileStyle

instance Prelude.NFData TileStyle

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