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

-- | Metadata that contains a description for a column.
--
-- /See:/ 'newColumnDescription' smart constructor.
data ColumnDescription = ColumnDescription'
  { -- | The text of a description for a column.
    ColumnDescription -> Maybe Text
text :: Prelude.Maybe Prelude.Text
  }
  deriving (ColumnDescription -> ColumnDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnDescription -> ColumnDescription -> Bool
$c/= :: ColumnDescription -> ColumnDescription -> Bool
== :: ColumnDescription -> ColumnDescription -> Bool
$c== :: ColumnDescription -> ColumnDescription -> Bool
Prelude.Eq, ReadPrec [ColumnDescription]
ReadPrec ColumnDescription
Int -> ReadS ColumnDescription
ReadS [ColumnDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnDescription]
$creadListPrec :: ReadPrec [ColumnDescription]
readPrec :: ReadPrec ColumnDescription
$creadPrec :: ReadPrec ColumnDescription
readList :: ReadS [ColumnDescription]
$creadList :: ReadS [ColumnDescription]
readsPrec :: Int -> ReadS ColumnDescription
$creadsPrec :: Int -> ReadS ColumnDescription
Prelude.Read, Int -> ColumnDescription -> ShowS
[ColumnDescription] -> ShowS
ColumnDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnDescription] -> ShowS
$cshowList :: [ColumnDescription] -> ShowS
show :: ColumnDescription -> String
$cshow :: ColumnDescription -> String
showsPrec :: Int -> ColumnDescription -> ShowS
$cshowsPrec :: Int -> ColumnDescription -> ShowS
Prelude.Show, forall x. Rep ColumnDescription x -> ColumnDescription
forall x. ColumnDescription -> Rep ColumnDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnDescription x -> ColumnDescription
$cfrom :: forall x. ColumnDescription -> Rep ColumnDescription x
Prelude.Generic)

-- |
-- Create a value of 'ColumnDescription' 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:
--
-- 'text', 'columnDescription_text' - The text of a description for a column.
newColumnDescription ::
  ColumnDescription
newColumnDescription :: ColumnDescription
newColumnDescription =
  ColumnDescription' {$sel:text:ColumnDescription' :: Maybe Text
text = forall a. Maybe a
Prelude.Nothing}

-- | The text of a description for a column.
columnDescription_text :: Lens.Lens' ColumnDescription (Prelude.Maybe Prelude.Text)
columnDescription_text :: Lens' ColumnDescription (Maybe Text)
columnDescription_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnDescription' {Maybe Text
text :: Maybe Text
$sel:text:ColumnDescription' :: ColumnDescription -> Maybe Text
text} -> Maybe Text
text) (\s :: ColumnDescription
s@ColumnDescription' {} Maybe Text
a -> ColumnDescription
s {$sel:text:ColumnDescription' :: Maybe Text
text = Maybe Text
a} :: ColumnDescription)

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

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

instance Prelude.NFData ColumnDescription where
  rnf :: ColumnDescription -> ()
rnf ColumnDescription' {Maybe Text
text :: Maybe Text
$sel:text:ColumnDescription' :: ColumnDescription -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
text

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