{-# 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.FreeFormLayoutElementBackgroundStyle
-- 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.FreeFormLayoutElementBackgroundStyle 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.Visibility

-- | The background style configuration of a free-form layout element.
--
-- /See:/ 'newFreeFormLayoutElementBackgroundStyle' smart constructor.
data FreeFormLayoutElementBackgroundStyle = FreeFormLayoutElementBackgroundStyle'
  { -- | The background color of a free-form layout element.
    FreeFormLayoutElementBackgroundStyle -> Maybe Text
color :: Prelude.Maybe Prelude.Text,
    -- | The background visibility of a free-form layout element.
    FreeFormLayoutElementBackgroundStyle -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (FreeFormLayoutElementBackgroundStyle
-> FreeFormLayoutElementBackgroundStyle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FreeFormLayoutElementBackgroundStyle
-> FreeFormLayoutElementBackgroundStyle -> Bool
$c/= :: FreeFormLayoutElementBackgroundStyle
-> FreeFormLayoutElementBackgroundStyle -> Bool
== :: FreeFormLayoutElementBackgroundStyle
-> FreeFormLayoutElementBackgroundStyle -> Bool
$c== :: FreeFormLayoutElementBackgroundStyle
-> FreeFormLayoutElementBackgroundStyle -> Bool
Prelude.Eq, ReadPrec [FreeFormLayoutElementBackgroundStyle]
ReadPrec FreeFormLayoutElementBackgroundStyle
Int -> ReadS FreeFormLayoutElementBackgroundStyle
ReadS [FreeFormLayoutElementBackgroundStyle]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FreeFormLayoutElementBackgroundStyle]
$creadListPrec :: ReadPrec [FreeFormLayoutElementBackgroundStyle]
readPrec :: ReadPrec FreeFormLayoutElementBackgroundStyle
$creadPrec :: ReadPrec FreeFormLayoutElementBackgroundStyle
readList :: ReadS [FreeFormLayoutElementBackgroundStyle]
$creadList :: ReadS [FreeFormLayoutElementBackgroundStyle]
readsPrec :: Int -> ReadS FreeFormLayoutElementBackgroundStyle
$creadsPrec :: Int -> ReadS FreeFormLayoutElementBackgroundStyle
Prelude.Read, Int -> FreeFormLayoutElementBackgroundStyle -> ShowS
[FreeFormLayoutElementBackgroundStyle] -> ShowS
FreeFormLayoutElementBackgroundStyle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FreeFormLayoutElementBackgroundStyle] -> ShowS
$cshowList :: [FreeFormLayoutElementBackgroundStyle] -> ShowS
show :: FreeFormLayoutElementBackgroundStyle -> String
$cshow :: FreeFormLayoutElementBackgroundStyle -> String
showsPrec :: Int -> FreeFormLayoutElementBackgroundStyle -> ShowS
$cshowsPrec :: Int -> FreeFormLayoutElementBackgroundStyle -> ShowS
Prelude.Show, forall x.
Rep FreeFormLayoutElementBackgroundStyle x
-> FreeFormLayoutElementBackgroundStyle
forall x.
FreeFormLayoutElementBackgroundStyle
-> Rep FreeFormLayoutElementBackgroundStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FreeFormLayoutElementBackgroundStyle x
-> FreeFormLayoutElementBackgroundStyle
$cfrom :: forall x.
FreeFormLayoutElementBackgroundStyle
-> Rep FreeFormLayoutElementBackgroundStyle x
Prelude.Generic)

-- |
-- Create a value of 'FreeFormLayoutElementBackgroundStyle' 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:
--
-- 'color', 'freeFormLayoutElementBackgroundStyle_color' - The background color of a free-form layout element.
--
-- 'visibility', 'freeFormLayoutElementBackgroundStyle_visibility' - The background visibility of a free-form layout element.
newFreeFormLayoutElementBackgroundStyle ::
  FreeFormLayoutElementBackgroundStyle
newFreeFormLayoutElementBackgroundStyle :: FreeFormLayoutElementBackgroundStyle
newFreeFormLayoutElementBackgroundStyle =
  FreeFormLayoutElementBackgroundStyle'
    { $sel:color:FreeFormLayoutElementBackgroundStyle' :: Maybe Text
color =
        forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:FreeFormLayoutElementBackgroundStyle' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing
    }

-- | The background color of a free-form layout element.
freeFormLayoutElementBackgroundStyle_color :: Lens.Lens' FreeFormLayoutElementBackgroundStyle (Prelude.Maybe Prelude.Text)
freeFormLayoutElementBackgroundStyle_color :: Lens' FreeFormLayoutElementBackgroundStyle (Maybe Text)
freeFormLayoutElementBackgroundStyle_color = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeFormLayoutElementBackgroundStyle' {Maybe Text
color :: Maybe Text
$sel:color:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Text
color} -> Maybe Text
color) (\s :: FreeFormLayoutElementBackgroundStyle
s@FreeFormLayoutElementBackgroundStyle' {} Maybe Text
a -> FreeFormLayoutElementBackgroundStyle
s {$sel:color:FreeFormLayoutElementBackgroundStyle' :: Maybe Text
color = Maybe Text
a} :: FreeFormLayoutElementBackgroundStyle)

-- | The background visibility of a free-form layout element.
freeFormLayoutElementBackgroundStyle_visibility :: Lens.Lens' FreeFormLayoutElementBackgroundStyle (Prelude.Maybe Visibility)
freeFormLayoutElementBackgroundStyle_visibility :: Lens' FreeFormLayoutElementBackgroundStyle (Maybe Visibility)
freeFormLayoutElementBackgroundStyle_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeFormLayoutElementBackgroundStyle' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: FreeFormLayoutElementBackgroundStyle
s@FreeFormLayoutElementBackgroundStyle' {} Maybe Visibility
a -> FreeFormLayoutElementBackgroundStyle
s {$sel:visibility:FreeFormLayoutElementBackgroundStyle' :: Maybe Visibility
visibility = Maybe Visibility
a} :: FreeFormLayoutElementBackgroundStyle)

instance
  Data.FromJSON
    FreeFormLayoutElementBackgroundStyle
  where
  parseJSON :: Value -> Parser FreeFormLayoutElementBackgroundStyle
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FreeFormLayoutElementBackgroundStyle"
      ( \Object
x ->
          Maybe Text
-> Maybe Visibility -> FreeFormLayoutElementBackgroundStyle
FreeFormLayoutElementBackgroundStyle'
            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
"Color")
            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
"Visibility")
      )

instance
  Prelude.Hashable
    FreeFormLayoutElementBackgroundStyle
  where
  hashWithSalt :: Int -> FreeFormLayoutElementBackgroundStyle -> Int
hashWithSalt
    Int
_salt
    FreeFormLayoutElementBackgroundStyle' {Maybe Text
Maybe Visibility
visibility :: Maybe Visibility
color :: Maybe Text
$sel:visibility:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Visibility
$sel:color:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
color
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance
  Prelude.NFData
    FreeFormLayoutElementBackgroundStyle
  where
  rnf :: FreeFormLayoutElementBackgroundStyle -> ()
rnf FreeFormLayoutElementBackgroundStyle' {Maybe Text
Maybe Visibility
visibility :: Maybe Visibility
color :: Maybe Text
$sel:visibility:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Visibility
$sel:color:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
color
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

instance
  Data.ToJSON
    FreeFormLayoutElementBackgroundStyle
  where
  toJSON :: FreeFormLayoutElementBackgroundStyle -> Value
toJSON FreeFormLayoutElementBackgroundStyle' {Maybe Text
Maybe Visibility
visibility :: Maybe Visibility
color :: Maybe Text
$sel:visibility:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Visibility
$sel:color:FreeFormLayoutElementBackgroundStyle' :: FreeFormLayoutElementBackgroundStyle -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Color" 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 Text
color,
            (Key
"Visibility" 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 Visibility
visibility
          ]
      )