{-# 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.TableFieldCustomTextContent
-- 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.TableFieldCustomTextContent 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.FontConfiguration

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

-- |
-- Create a value of 'TableFieldCustomTextContent' 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:
--
-- 'value', 'tableFieldCustomTextContent_value' - The string value of the custom text content for the table URL link
-- content.
--
-- 'fontConfiguration', 'tableFieldCustomTextContent_fontConfiguration' - The font configuration of the custom text content for the table URL link
-- content.
newTableFieldCustomTextContent ::
  -- | 'fontConfiguration'
  FontConfiguration ->
  TableFieldCustomTextContent
newTableFieldCustomTextContent :: FontConfiguration -> TableFieldCustomTextContent
newTableFieldCustomTextContent FontConfiguration
pFontConfiguration_ =
  TableFieldCustomTextContent'
    { $sel:value:TableFieldCustomTextContent' :: Maybe Text
value =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fontConfiguration:TableFieldCustomTextContent' :: FontConfiguration
fontConfiguration = FontConfiguration
pFontConfiguration_
    }

-- | The string value of the custom text content for the table URL link
-- content.
tableFieldCustomTextContent_value :: Lens.Lens' TableFieldCustomTextContent (Prelude.Maybe Prelude.Text)
tableFieldCustomTextContent_value :: Lens' TableFieldCustomTextContent (Maybe Text)
tableFieldCustomTextContent_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldCustomTextContent' {Maybe Text
value :: Maybe Text
$sel:value:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> Maybe Text
value} -> Maybe Text
value) (\s :: TableFieldCustomTextContent
s@TableFieldCustomTextContent' {} Maybe Text
a -> TableFieldCustomTextContent
s {$sel:value:TableFieldCustomTextContent' :: Maybe Text
value = Maybe Text
a} :: TableFieldCustomTextContent)

-- | The font configuration of the custom text content for the table URL link
-- content.
tableFieldCustomTextContent_fontConfiguration :: Lens.Lens' TableFieldCustomTextContent FontConfiguration
tableFieldCustomTextContent_fontConfiguration :: Lens' TableFieldCustomTextContent FontConfiguration
tableFieldCustomTextContent_fontConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldCustomTextContent' {FontConfiguration
fontConfiguration :: FontConfiguration
$sel:fontConfiguration:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> FontConfiguration
fontConfiguration} -> FontConfiguration
fontConfiguration) (\s :: TableFieldCustomTextContent
s@TableFieldCustomTextContent' {} FontConfiguration
a -> TableFieldCustomTextContent
s {$sel:fontConfiguration:TableFieldCustomTextContent' :: FontConfiguration
fontConfiguration = FontConfiguration
a} :: TableFieldCustomTextContent)

instance Data.FromJSON TableFieldCustomTextContent where
  parseJSON :: Value -> Parser TableFieldCustomTextContent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableFieldCustomTextContent"
      ( \Object
x ->
          Maybe Text -> FontConfiguration -> TableFieldCustomTextContent
TableFieldCustomTextContent'
            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
"Value")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FontConfiguration")
      )

instance Prelude.Hashable TableFieldCustomTextContent where
  hashWithSalt :: Int -> TableFieldCustomTextContent -> Int
hashWithSalt Int
_salt TableFieldCustomTextContent' {Maybe Text
FontConfiguration
fontConfiguration :: FontConfiguration
value :: Maybe Text
$sel:fontConfiguration:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> FontConfiguration
$sel:value:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FontConfiguration
fontConfiguration

instance Prelude.NFData TableFieldCustomTextContent where
  rnf :: TableFieldCustomTextContent -> ()
rnf TableFieldCustomTextContent' {Maybe Text
FontConfiguration
fontConfiguration :: FontConfiguration
value :: Maybe Text
$sel:fontConfiguration:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> FontConfiguration
$sel:value:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FontConfiguration
fontConfiguration

instance Data.ToJSON TableFieldCustomTextContent where
  toJSON :: TableFieldCustomTextContent -> Value
toJSON TableFieldCustomTextContent' {Maybe Text
FontConfiguration
fontConfiguration :: FontConfiguration
value :: Maybe Text
$sel:fontConfiguration:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> FontConfiguration
$sel:value:TableFieldCustomTextContent' :: TableFieldCustomTextContent -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Value" 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
value,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FontConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FontConfiguration
fontConfiguration)
          ]
      )