{-# 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.SheetTextBox
-- 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.SheetTextBox 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

-- | A text box.
--
-- /See:/ 'newSheetTextBox' smart constructor.
data SheetTextBox = SheetTextBox'
  { -- | The content that is displayed in the text box.
    SheetTextBox -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for a text box. This identifier must be unique
    -- within the context of a dashboard, template, or analysis. Two
    -- dashboards, analyses, or templates can have text boxes that share
    -- identifiers.
    SheetTextBox -> Text
sheetTextBoxId :: Prelude.Text
  }
  deriving (SheetTextBox -> SheetTextBox -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SheetTextBox -> SheetTextBox -> Bool
$c/= :: SheetTextBox -> SheetTextBox -> Bool
== :: SheetTextBox -> SheetTextBox -> Bool
$c== :: SheetTextBox -> SheetTextBox -> Bool
Prelude.Eq, ReadPrec [SheetTextBox]
ReadPrec SheetTextBox
Int -> ReadS SheetTextBox
ReadS [SheetTextBox]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SheetTextBox]
$creadListPrec :: ReadPrec [SheetTextBox]
readPrec :: ReadPrec SheetTextBox
$creadPrec :: ReadPrec SheetTextBox
readList :: ReadS [SheetTextBox]
$creadList :: ReadS [SheetTextBox]
readsPrec :: Int -> ReadS SheetTextBox
$creadsPrec :: Int -> ReadS SheetTextBox
Prelude.Read, Int -> SheetTextBox -> ShowS
[SheetTextBox] -> ShowS
SheetTextBox -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SheetTextBox] -> ShowS
$cshowList :: [SheetTextBox] -> ShowS
show :: SheetTextBox -> String
$cshow :: SheetTextBox -> String
showsPrec :: Int -> SheetTextBox -> ShowS
$cshowsPrec :: Int -> SheetTextBox -> ShowS
Prelude.Show, forall x. Rep SheetTextBox x -> SheetTextBox
forall x. SheetTextBox -> Rep SheetTextBox x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SheetTextBox x -> SheetTextBox
$cfrom :: forall x. SheetTextBox -> Rep SheetTextBox x
Prelude.Generic)

-- |
-- Create a value of 'SheetTextBox' 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:
--
-- 'content', 'sheetTextBox_content' - The content that is displayed in the text box.
--
-- 'sheetTextBoxId', 'sheetTextBox_sheetTextBoxId' - The unique identifier for a text box. This identifier must be unique
-- within the context of a dashboard, template, or analysis. Two
-- dashboards, analyses, or templates can have text boxes that share
-- identifiers.
newSheetTextBox ::
  -- | 'sheetTextBoxId'
  Prelude.Text ->
  SheetTextBox
newSheetTextBox :: Text -> SheetTextBox
newSheetTextBox Text
pSheetTextBoxId_ =
  SheetTextBox'
    { $sel:content:SheetTextBox' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
      $sel:sheetTextBoxId:SheetTextBox' :: Text
sheetTextBoxId = Text
pSheetTextBoxId_
    }

-- | The content that is displayed in the text box.
sheetTextBox_content :: Lens.Lens' SheetTextBox (Prelude.Maybe Prelude.Text)
sheetTextBox_content :: Lens' SheetTextBox (Maybe Text)
sheetTextBox_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetTextBox' {Maybe Text
content :: Maybe Text
$sel:content:SheetTextBox' :: SheetTextBox -> Maybe Text
content} -> Maybe Text
content) (\s :: SheetTextBox
s@SheetTextBox' {} Maybe Text
a -> SheetTextBox
s {$sel:content:SheetTextBox' :: Maybe Text
content = Maybe Text
a} :: SheetTextBox)

-- | The unique identifier for a text box. This identifier must be unique
-- within the context of a dashboard, template, or analysis. Two
-- dashboards, analyses, or templates can have text boxes that share
-- identifiers.
sheetTextBox_sheetTextBoxId :: Lens.Lens' SheetTextBox Prelude.Text
sheetTextBox_sheetTextBoxId :: Lens' SheetTextBox Text
sheetTextBox_sheetTextBoxId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetTextBox' {Text
sheetTextBoxId :: Text
$sel:sheetTextBoxId:SheetTextBox' :: SheetTextBox -> Text
sheetTextBoxId} -> Text
sheetTextBoxId) (\s :: SheetTextBox
s@SheetTextBox' {} Text
a -> SheetTextBox
s {$sel:sheetTextBoxId:SheetTextBox' :: Text
sheetTextBoxId = Text
a} :: SheetTextBox)

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

instance Prelude.Hashable SheetTextBox where
  hashWithSalt :: Int -> SheetTextBox -> Int
hashWithSalt Int
_salt SheetTextBox' {Maybe Text
Text
sheetTextBoxId :: Text
content :: Maybe Text
$sel:sheetTextBoxId:SheetTextBox' :: SheetTextBox -> Text
$sel:content:SheetTextBox' :: SheetTextBox -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sheetTextBoxId

instance Prelude.NFData SheetTextBox where
  rnf :: SheetTextBox -> ()
rnf SheetTextBox' {Maybe Text
Text
sheetTextBoxId :: Text
content :: Maybe Text
$sel:sheetTextBoxId:SheetTextBox' :: SheetTextBox -> Text
$sel:content:SheetTextBox' :: SheetTextBox -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sheetTextBoxId

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