{-# 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.FieldTooltipItem
-- 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.FieldTooltipItem 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.Visibility

-- | The tooltip item for the fields.
--
-- /See:/ 'newFieldTooltipItem' smart constructor.
data FieldTooltipItem = FieldTooltipItem'
  { -- | The label of the tooltip item.
    FieldTooltipItem -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The visibility of the tooltip item.
    FieldTooltipItem -> Maybe Visibility
visibility :: Prelude.Maybe Visibility,
    -- | The unique ID of the field that is targeted by the tooltip.
    FieldTooltipItem -> Text
fieldId :: Prelude.Text
  }
  deriving (FieldTooltipItem -> FieldTooltipItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldTooltipItem -> FieldTooltipItem -> Bool
$c/= :: FieldTooltipItem -> FieldTooltipItem -> Bool
== :: FieldTooltipItem -> FieldTooltipItem -> Bool
$c== :: FieldTooltipItem -> FieldTooltipItem -> Bool
Prelude.Eq, ReadPrec [FieldTooltipItem]
ReadPrec FieldTooltipItem
Int -> ReadS FieldTooltipItem
ReadS [FieldTooltipItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldTooltipItem]
$creadListPrec :: ReadPrec [FieldTooltipItem]
readPrec :: ReadPrec FieldTooltipItem
$creadPrec :: ReadPrec FieldTooltipItem
readList :: ReadS [FieldTooltipItem]
$creadList :: ReadS [FieldTooltipItem]
readsPrec :: Int -> ReadS FieldTooltipItem
$creadsPrec :: Int -> ReadS FieldTooltipItem
Prelude.Read, Int -> FieldTooltipItem -> ShowS
[FieldTooltipItem] -> ShowS
FieldTooltipItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldTooltipItem] -> ShowS
$cshowList :: [FieldTooltipItem] -> ShowS
show :: FieldTooltipItem -> String
$cshow :: FieldTooltipItem -> String
showsPrec :: Int -> FieldTooltipItem -> ShowS
$cshowsPrec :: Int -> FieldTooltipItem -> ShowS
Prelude.Show, forall x. Rep FieldTooltipItem x -> FieldTooltipItem
forall x. FieldTooltipItem -> Rep FieldTooltipItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldTooltipItem x -> FieldTooltipItem
$cfrom :: forall x. FieldTooltipItem -> Rep FieldTooltipItem x
Prelude.Generic)

-- |
-- Create a value of 'FieldTooltipItem' 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:
--
-- 'label', 'fieldTooltipItem_label' - The label of the tooltip item.
--
-- 'visibility', 'fieldTooltipItem_visibility' - The visibility of the tooltip item.
--
-- 'fieldId', 'fieldTooltipItem_fieldId' - The unique ID of the field that is targeted by the tooltip.
newFieldTooltipItem ::
  -- | 'fieldId'
  Prelude.Text ->
  FieldTooltipItem
newFieldTooltipItem :: Text -> FieldTooltipItem
newFieldTooltipItem Text
pFieldId_ =
  FieldTooltipItem'
    { $sel:label:FieldTooltipItem' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:FieldTooltipItem' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing,
      $sel:fieldId:FieldTooltipItem' :: Text
fieldId = Text
pFieldId_
    }

-- | The label of the tooltip item.
fieldTooltipItem_label :: Lens.Lens' FieldTooltipItem (Prelude.Maybe Prelude.Text)
fieldTooltipItem_label :: Lens' FieldTooltipItem (Maybe Text)
fieldTooltipItem_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldTooltipItem' {Maybe Text
label :: Maybe Text
$sel:label:FieldTooltipItem' :: FieldTooltipItem -> Maybe Text
label} -> Maybe Text
label) (\s :: FieldTooltipItem
s@FieldTooltipItem' {} Maybe Text
a -> FieldTooltipItem
s {$sel:label:FieldTooltipItem' :: Maybe Text
label = Maybe Text
a} :: FieldTooltipItem)

-- | The visibility of the tooltip item.
fieldTooltipItem_visibility :: Lens.Lens' FieldTooltipItem (Prelude.Maybe Visibility)
fieldTooltipItem_visibility :: Lens' FieldTooltipItem (Maybe Visibility)
fieldTooltipItem_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldTooltipItem' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:FieldTooltipItem' :: FieldTooltipItem -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: FieldTooltipItem
s@FieldTooltipItem' {} Maybe Visibility
a -> FieldTooltipItem
s {$sel:visibility:FieldTooltipItem' :: Maybe Visibility
visibility = Maybe Visibility
a} :: FieldTooltipItem)

-- | The unique ID of the field that is targeted by the tooltip.
fieldTooltipItem_fieldId :: Lens.Lens' FieldTooltipItem Prelude.Text
fieldTooltipItem_fieldId :: Lens' FieldTooltipItem Text
fieldTooltipItem_fieldId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldTooltipItem' {Text
fieldId :: Text
$sel:fieldId:FieldTooltipItem' :: FieldTooltipItem -> Text
fieldId} -> Text
fieldId) (\s :: FieldTooltipItem
s@FieldTooltipItem' {} Text
a -> FieldTooltipItem
s {$sel:fieldId:FieldTooltipItem' :: Text
fieldId = Text
a} :: FieldTooltipItem)

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

instance Prelude.Hashable FieldTooltipItem where
  hashWithSalt :: Int -> FieldTooltipItem -> Int
hashWithSalt Int
_salt FieldTooltipItem' {Maybe Text
Maybe Visibility
Text
fieldId :: Text
visibility :: Maybe Visibility
label :: Maybe Text
$sel:fieldId:FieldTooltipItem' :: FieldTooltipItem -> Text
$sel:visibility:FieldTooltipItem' :: FieldTooltipItem -> Maybe Visibility
$sel:label:FieldTooltipItem' :: FieldTooltipItem -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fieldId

instance Prelude.NFData FieldTooltipItem where
  rnf :: FieldTooltipItem -> ()
rnf FieldTooltipItem' {Maybe Text
Maybe Visibility
Text
fieldId :: Text
visibility :: Maybe Visibility
label :: Maybe Text
$sel:fieldId:FieldTooltipItem' :: FieldTooltipItem -> Text
$sel:visibility:FieldTooltipItem' :: FieldTooltipItem -> Maybe Visibility
$sel:label:FieldTooltipItem' :: FieldTooltipItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fieldId

instance Data.ToJSON FieldTooltipItem where
  toJSON :: FieldTooltipItem -> Value
toJSON FieldTooltipItem' {Maybe Text
Maybe Visibility
Text
fieldId :: Text
visibility :: Maybe Visibility
label :: Maybe Text
$sel:fieldId:FieldTooltipItem' :: FieldTooltipItem -> Text
$sel:visibility:FieldTooltipItem' :: FieldTooltipItem -> Maybe Visibility
$sel:label:FieldTooltipItem' :: FieldTooltipItem -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Label" 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
label,
            (Key
"Visibility" 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 Visibility
visibility,
            forall a. a -> Maybe a
Prelude.Just (Key
"FieldId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fieldId)
          ]
      )