{-# 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.TableFieldLinkContentConfiguration
-- 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.TableFieldLinkContentConfiguration 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.TableFieldCustomIconContent
import Amazonka.QuickSight.Types.TableFieldCustomTextContent

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

-- |
-- Create a value of 'TableFieldLinkContentConfiguration' 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:
--
-- 'customIconContent', 'tableFieldLinkContentConfiguration_customIconContent' - The custom icon content for the table link content configuration.
--
-- 'customTextContent', 'tableFieldLinkContentConfiguration_customTextContent' - The custom text content (value, font configuration) for the table link
-- content configuration.
newTableFieldLinkContentConfiguration ::
  TableFieldLinkContentConfiguration
newTableFieldLinkContentConfiguration :: TableFieldLinkContentConfiguration
newTableFieldLinkContentConfiguration =
  TableFieldLinkContentConfiguration'
    { $sel:customIconContent:TableFieldLinkContentConfiguration' :: Maybe TableFieldCustomIconContent
customIconContent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customTextContent:TableFieldLinkContentConfiguration' :: Maybe TableFieldCustomTextContent
customTextContent = forall a. Maybe a
Prelude.Nothing
    }

-- | The custom icon content for the table link content configuration.
tableFieldLinkContentConfiguration_customIconContent :: Lens.Lens' TableFieldLinkContentConfiguration (Prelude.Maybe TableFieldCustomIconContent)
tableFieldLinkContentConfiguration_customIconContent :: Lens'
  TableFieldLinkContentConfiguration
  (Maybe TableFieldCustomIconContent)
tableFieldLinkContentConfiguration_customIconContent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldLinkContentConfiguration' {Maybe TableFieldCustomIconContent
customIconContent :: Maybe TableFieldCustomIconContent
$sel:customIconContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomIconContent
customIconContent} -> Maybe TableFieldCustomIconContent
customIconContent) (\s :: TableFieldLinkContentConfiguration
s@TableFieldLinkContentConfiguration' {} Maybe TableFieldCustomIconContent
a -> TableFieldLinkContentConfiguration
s {$sel:customIconContent:TableFieldLinkContentConfiguration' :: Maybe TableFieldCustomIconContent
customIconContent = Maybe TableFieldCustomIconContent
a} :: TableFieldLinkContentConfiguration)

-- | The custom text content (value, font configuration) for the table link
-- content configuration.
tableFieldLinkContentConfiguration_customTextContent :: Lens.Lens' TableFieldLinkContentConfiguration (Prelude.Maybe TableFieldCustomTextContent)
tableFieldLinkContentConfiguration_customTextContent :: Lens'
  TableFieldLinkContentConfiguration
  (Maybe TableFieldCustomTextContent)
tableFieldLinkContentConfiguration_customTextContent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldLinkContentConfiguration' {Maybe TableFieldCustomTextContent
customTextContent :: Maybe TableFieldCustomTextContent
$sel:customTextContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomTextContent
customTextContent} -> Maybe TableFieldCustomTextContent
customTextContent) (\s :: TableFieldLinkContentConfiguration
s@TableFieldLinkContentConfiguration' {} Maybe TableFieldCustomTextContent
a -> TableFieldLinkContentConfiguration
s {$sel:customTextContent:TableFieldLinkContentConfiguration' :: Maybe TableFieldCustomTextContent
customTextContent = Maybe TableFieldCustomTextContent
a} :: TableFieldLinkContentConfiguration)

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

instance
  Prelude.Hashable
    TableFieldLinkContentConfiguration
  where
  hashWithSalt :: Int -> TableFieldLinkContentConfiguration -> Int
hashWithSalt
    Int
_salt
    TableFieldLinkContentConfiguration' {Maybe TableFieldCustomTextContent
Maybe TableFieldCustomIconContent
customTextContent :: Maybe TableFieldCustomTextContent
customIconContent :: Maybe TableFieldCustomIconContent
$sel:customTextContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomTextContent
$sel:customIconContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomIconContent
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableFieldCustomIconContent
customIconContent
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableFieldCustomTextContent
customTextContent

instance
  Prelude.NFData
    TableFieldLinkContentConfiguration
  where
  rnf :: TableFieldLinkContentConfiguration -> ()
rnf TableFieldLinkContentConfiguration' {Maybe TableFieldCustomTextContent
Maybe TableFieldCustomIconContent
customTextContent :: Maybe TableFieldCustomTextContent
customIconContent :: Maybe TableFieldCustomIconContent
$sel:customTextContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomTextContent
$sel:customIconContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomIconContent
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TableFieldCustomIconContent
customIconContent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableFieldCustomTextContent
customTextContent

instance
  Data.ToJSON
    TableFieldLinkContentConfiguration
  where
  toJSON :: TableFieldLinkContentConfiguration -> Value
toJSON TableFieldLinkContentConfiguration' {Maybe TableFieldCustomTextContent
Maybe TableFieldCustomIconContent
customTextContent :: Maybe TableFieldCustomTextContent
customIconContent :: Maybe TableFieldCustomIconContent
$sel:customTextContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomTextContent
$sel:customIconContent:TableFieldLinkContentConfiguration' :: TableFieldLinkContentConfiguration
-> Maybe TableFieldCustomIconContent
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CustomIconContent" 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 TableFieldCustomIconContent
customIconContent,
            (Key
"CustomTextContent" 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 TableFieldCustomTextContent
customTextContent
          ]
      )