{-# 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.ShapeConditionalFormat
-- 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.ShapeConditionalFormat 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.ConditionalFormattingColor

-- | The shape conditional formatting of a filled map visual.
--
-- /See:/ 'newShapeConditionalFormat' smart constructor.
data ShapeConditionalFormat = ShapeConditionalFormat'
  { -- | The conditional formatting for the shape background color of a filled
    -- map visual.
    ShapeConditionalFormat -> ConditionalFormattingColor
backgroundColor :: ConditionalFormattingColor
  }
  deriving (ShapeConditionalFormat -> ShapeConditionalFormat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShapeConditionalFormat -> ShapeConditionalFormat -> Bool
$c/= :: ShapeConditionalFormat -> ShapeConditionalFormat -> Bool
== :: ShapeConditionalFormat -> ShapeConditionalFormat -> Bool
$c== :: ShapeConditionalFormat -> ShapeConditionalFormat -> Bool
Prelude.Eq, Int -> ShapeConditionalFormat -> ShowS
[ShapeConditionalFormat] -> ShowS
ShapeConditionalFormat -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShapeConditionalFormat] -> ShowS
$cshowList :: [ShapeConditionalFormat] -> ShowS
show :: ShapeConditionalFormat -> String
$cshow :: ShapeConditionalFormat -> String
showsPrec :: Int -> ShapeConditionalFormat -> ShowS
$cshowsPrec :: Int -> ShapeConditionalFormat -> ShowS
Prelude.Show, forall x. Rep ShapeConditionalFormat x -> ShapeConditionalFormat
forall x. ShapeConditionalFormat -> Rep ShapeConditionalFormat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShapeConditionalFormat x -> ShapeConditionalFormat
$cfrom :: forall x. ShapeConditionalFormat -> Rep ShapeConditionalFormat x
Prelude.Generic)

-- |
-- Create a value of 'ShapeConditionalFormat' 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:
--
-- 'backgroundColor', 'shapeConditionalFormat_backgroundColor' - The conditional formatting for the shape background color of a filled
-- map visual.
newShapeConditionalFormat ::
  -- | 'backgroundColor'
  ConditionalFormattingColor ->
  ShapeConditionalFormat
newShapeConditionalFormat :: ConditionalFormattingColor -> ShapeConditionalFormat
newShapeConditionalFormat ConditionalFormattingColor
pBackgroundColor_ =
  ShapeConditionalFormat'
    { $sel:backgroundColor:ShapeConditionalFormat' :: ConditionalFormattingColor
backgroundColor =
        ConditionalFormattingColor
pBackgroundColor_
    }

-- | The conditional formatting for the shape background color of a filled
-- map visual.
shapeConditionalFormat_backgroundColor :: Lens.Lens' ShapeConditionalFormat ConditionalFormattingColor
shapeConditionalFormat_backgroundColor :: Lens' ShapeConditionalFormat ConditionalFormattingColor
shapeConditionalFormat_backgroundColor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShapeConditionalFormat' {ConditionalFormattingColor
backgroundColor :: ConditionalFormattingColor
$sel:backgroundColor:ShapeConditionalFormat' :: ShapeConditionalFormat -> ConditionalFormattingColor
backgroundColor} -> ConditionalFormattingColor
backgroundColor) (\s :: ShapeConditionalFormat
s@ShapeConditionalFormat' {} ConditionalFormattingColor
a -> ShapeConditionalFormat
s {$sel:backgroundColor:ShapeConditionalFormat' :: ConditionalFormattingColor
backgroundColor = ConditionalFormattingColor
a} :: ShapeConditionalFormat)

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

instance Prelude.Hashable ShapeConditionalFormat where
  hashWithSalt :: Int -> ShapeConditionalFormat -> Int
hashWithSalt Int
_salt ShapeConditionalFormat' {ConditionalFormattingColor
backgroundColor :: ConditionalFormattingColor
$sel:backgroundColor:ShapeConditionalFormat' :: ShapeConditionalFormat -> ConditionalFormattingColor
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConditionalFormattingColor
backgroundColor

instance Prelude.NFData ShapeConditionalFormat where
  rnf :: ShapeConditionalFormat -> ()
rnf ShapeConditionalFormat' {ConditionalFormattingColor
backgroundColor :: ConditionalFormattingColor
$sel:backgroundColor:ShapeConditionalFormat' :: ShapeConditionalFormat -> ConditionalFormattingColor
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ConditionalFormattingColor
backgroundColor

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