{-# 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.TableFieldCustomIconContent
-- 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.TableFieldCustomIconContent 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.TableFieldIconSetType

-- | The custom icon content for the table link content configuration.
--
-- /See:/ 'newTableFieldCustomIconContent' smart constructor.
data TableFieldCustomIconContent = TableFieldCustomIconContent'
  { -- | The icon set type (link) of the custom icon content for table URL link
    -- content.
    TableFieldCustomIconContent -> Maybe TableFieldIconSetType
icon :: Prelude.Maybe TableFieldIconSetType
  }
  deriving (TableFieldCustomIconContent -> TableFieldCustomIconContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableFieldCustomIconContent -> TableFieldCustomIconContent -> Bool
$c/= :: TableFieldCustomIconContent -> TableFieldCustomIconContent -> Bool
== :: TableFieldCustomIconContent -> TableFieldCustomIconContent -> Bool
$c== :: TableFieldCustomIconContent -> TableFieldCustomIconContent -> Bool
Prelude.Eq, ReadPrec [TableFieldCustomIconContent]
ReadPrec TableFieldCustomIconContent
Int -> ReadS TableFieldCustomIconContent
ReadS [TableFieldCustomIconContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableFieldCustomIconContent]
$creadListPrec :: ReadPrec [TableFieldCustomIconContent]
readPrec :: ReadPrec TableFieldCustomIconContent
$creadPrec :: ReadPrec TableFieldCustomIconContent
readList :: ReadS [TableFieldCustomIconContent]
$creadList :: ReadS [TableFieldCustomIconContent]
readsPrec :: Int -> ReadS TableFieldCustomIconContent
$creadsPrec :: Int -> ReadS TableFieldCustomIconContent
Prelude.Read, Int -> TableFieldCustomIconContent -> ShowS
[TableFieldCustomIconContent] -> ShowS
TableFieldCustomIconContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableFieldCustomIconContent] -> ShowS
$cshowList :: [TableFieldCustomIconContent] -> ShowS
show :: TableFieldCustomIconContent -> String
$cshow :: TableFieldCustomIconContent -> String
showsPrec :: Int -> TableFieldCustomIconContent -> ShowS
$cshowsPrec :: Int -> TableFieldCustomIconContent -> ShowS
Prelude.Show, forall x.
Rep TableFieldCustomIconContent x -> TableFieldCustomIconContent
forall x.
TableFieldCustomIconContent -> Rep TableFieldCustomIconContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TableFieldCustomIconContent x -> TableFieldCustomIconContent
$cfrom :: forall x.
TableFieldCustomIconContent -> Rep TableFieldCustomIconContent x
Prelude.Generic)

-- |
-- Create a value of 'TableFieldCustomIconContent' 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:
--
-- 'icon', 'tableFieldCustomIconContent_icon' - The icon set type (link) of the custom icon content for table URL link
-- content.
newTableFieldCustomIconContent ::
  TableFieldCustomIconContent
newTableFieldCustomIconContent :: TableFieldCustomIconContent
newTableFieldCustomIconContent =
  TableFieldCustomIconContent'
    { $sel:icon:TableFieldCustomIconContent' :: Maybe TableFieldIconSetType
icon =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The icon set type (link) of the custom icon content for table URL link
-- content.
tableFieldCustomIconContent_icon :: Lens.Lens' TableFieldCustomIconContent (Prelude.Maybe TableFieldIconSetType)
tableFieldCustomIconContent_icon :: Lens' TableFieldCustomIconContent (Maybe TableFieldIconSetType)
tableFieldCustomIconContent_icon = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldCustomIconContent' {Maybe TableFieldIconSetType
icon :: Maybe TableFieldIconSetType
$sel:icon:TableFieldCustomIconContent' :: TableFieldCustomIconContent -> Maybe TableFieldIconSetType
icon} -> Maybe TableFieldIconSetType
icon) (\s :: TableFieldCustomIconContent
s@TableFieldCustomIconContent' {} Maybe TableFieldIconSetType
a -> TableFieldCustomIconContent
s {$sel:icon:TableFieldCustomIconContent' :: Maybe TableFieldIconSetType
icon = Maybe TableFieldIconSetType
a} :: TableFieldCustomIconContent)

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

instance Prelude.Hashable TableFieldCustomIconContent where
  hashWithSalt :: Int -> TableFieldCustomIconContent -> Int
hashWithSalt Int
_salt TableFieldCustomIconContent' {Maybe TableFieldIconSetType
icon :: Maybe TableFieldIconSetType
$sel:icon:TableFieldCustomIconContent' :: TableFieldCustomIconContent -> Maybe TableFieldIconSetType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableFieldIconSetType
icon

instance Prelude.NFData TableFieldCustomIconContent where
  rnf :: TableFieldCustomIconContent -> ()
rnf TableFieldCustomIconContent' {Maybe TableFieldIconSetType
icon :: Maybe TableFieldIconSetType
$sel:icon:TableFieldCustomIconContent' :: TableFieldCustomIconContent -> Maybe TableFieldIconSetType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TableFieldIconSetType
icon

instance Data.ToJSON TableFieldCustomIconContent where
  toJSON :: TableFieldCustomIconContent -> Value
toJSON TableFieldCustomIconContent' {Maybe TableFieldIconSetType
icon :: Maybe TableFieldIconSetType
$sel:icon:TableFieldCustomIconContent' :: TableFieldCustomIconContent -> Maybe TableFieldIconSetType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Icon" 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 TableFieldIconSetType
icon]
      )