{-# 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.HoneyCode.Types.TableColumn
-- 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.HoneyCode.Types.TableColumn where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.HoneyCode.Types.Format
import qualified Amazonka.Prelude as Prelude

-- | An object that contains attributes about a single column in a table
--
-- /See:/ 'newTableColumn' smart constructor.
data TableColumn = TableColumn'
  { -- | The column level format that is applied in the table. An empty value in
    -- this field means that the column format is the default value \'AUTO\'.
    TableColumn -> Maybe Format
format :: Prelude.Maybe Format,
    -- | The id of the column in the table.
    TableColumn -> Maybe Text
tableColumnId :: Prelude.Maybe Prelude.Text,
    -- | The name of the column in the table.
    TableColumn -> Maybe Text
tableColumnName :: Prelude.Maybe Prelude.Text
  }
  deriving (TableColumn -> TableColumn -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableColumn -> TableColumn -> Bool
$c/= :: TableColumn -> TableColumn -> Bool
== :: TableColumn -> TableColumn -> Bool
$c== :: TableColumn -> TableColumn -> Bool
Prelude.Eq, ReadPrec [TableColumn]
ReadPrec TableColumn
Int -> ReadS TableColumn
ReadS [TableColumn]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableColumn]
$creadListPrec :: ReadPrec [TableColumn]
readPrec :: ReadPrec TableColumn
$creadPrec :: ReadPrec TableColumn
readList :: ReadS [TableColumn]
$creadList :: ReadS [TableColumn]
readsPrec :: Int -> ReadS TableColumn
$creadsPrec :: Int -> ReadS TableColumn
Prelude.Read, Int -> TableColumn -> ShowS
[TableColumn] -> ShowS
TableColumn -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableColumn] -> ShowS
$cshowList :: [TableColumn] -> ShowS
show :: TableColumn -> String
$cshow :: TableColumn -> String
showsPrec :: Int -> TableColumn -> ShowS
$cshowsPrec :: Int -> TableColumn -> ShowS
Prelude.Show, forall x. Rep TableColumn x -> TableColumn
forall x. TableColumn -> Rep TableColumn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableColumn x -> TableColumn
$cfrom :: forall x. TableColumn -> Rep TableColumn x
Prelude.Generic)

-- |
-- Create a value of 'TableColumn' 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:
--
-- 'format', 'tableColumn_format' - The column level format that is applied in the table. An empty value in
-- this field means that the column format is the default value \'AUTO\'.
--
-- 'tableColumnId', 'tableColumn_tableColumnId' - The id of the column in the table.
--
-- 'tableColumnName', 'tableColumn_tableColumnName' - The name of the column in the table.
newTableColumn ::
  TableColumn
newTableColumn :: TableColumn
newTableColumn =
  TableColumn'
    { $sel:format:TableColumn' :: Maybe Format
format = forall a. Maybe a
Prelude.Nothing,
      $sel:tableColumnId:TableColumn' :: Maybe Text
tableColumnId = forall a. Maybe a
Prelude.Nothing,
      $sel:tableColumnName:TableColumn' :: Maybe Text
tableColumnName = forall a. Maybe a
Prelude.Nothing
    }

-- | The column level format that is applied in the table. An empty value in
-- this field means that the column format is the default value \'AUTO\'.
tableColumn_format :: Lens.Lens' TableColumn (Prelude.Maybe Format)
tableColumn_format :: Lens' TableColumn (Maybe Format)
tableColumn_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableColumn' {Maybe Format
format :: Maybe Format
$sel:format:TableColumn' :: TableColumn -> Maybe Format
format} -> Maybe Format
format) (\s :: TableColumn
s@TableColumn' {} Maybe Format
a -> TableColumn
s {$sel:format:TableColumn' :: Maybe Format
format = Maybe Format
a} :: TableColumn)

-- | The id of the column in the table.
tableColumn_tableColumnId :: Lens.Lens' TableColumn (Prelude.Maybe Prelude.Text)
tableColumn_tableColumnId :: Lens' TableColumn (Maybe Text)
tableColumn_tableColumnId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableColumn' {Maybe Text
tableColumnId :: Maybe Text
$sel:tableColumnId:TableColumn' :: TableColumn -> Maybe Text
tableColumnId} -> Maybe Text
tableColumnId) (\s :: TableColumn
s@TableColumn' {} Maybe Text
a -> TableColumn
s {$sel:tableColumnId:TableColumn' :: Maybe Text
tableColumnId = Maybe Text
a} :: TableColumn)

-- | The name of the column in the table.
tableColumn_tableColumnName :: Lens.Lens' TableColumn (Prelude.Maybe Prelude.Text)
tableColumn_tableColumnName :: Lens' TableColumn (Maybe Text)
tableColumn_tableColumnName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableColumn' {Maybe Text
tableColumnName :: Maybe Text
$sel:tableColumnName:TableColumn' :: TableColumn -> Maybe Text
tableColumnName} -> Maybe Text
tableColumnName) (\s :: TableColumn
s@TableColumn' {} Maybe Text
a -> TableColumn
s {$sel:tableColumnName:TableColumn' :: Maybe Text
tableColumnName = Maybe Text
a} :: TableColumn)

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

instance Prelude.Hashable TableColumn where
  hashWithSalt :: Int -> TableColumn -> Int
hashWithSalt Int
_salt TableColumn' {Maybe Text
Maybe Format
tableColumnName :: Maybe Text
tableColumnId :: Maybe Text
format :: Maybe Format
$sel:tableColumnName:TableColumn' :: TableColumn -> Maybe Text
$sel:tableColumnId:TableColumn' :: TableColumn -> Maybe Text
$sel:format:TableColumn' :: TableColumn -> Maybe Format
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Format
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tableColumnId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tableColumnName

instance Prelude.NFData TableColumn where
  rnf :: TableColumn -> ()
rnf TableColumn' {Maybe Text
Maybe Format
tableColumnName :: Maybe Text
tableColumnId :: Maybe Text
format :: Maybe Format
$sel:tableColumnName:TableColumn' :: TableColumn -> Maybe Text
$sel:tableColumnId:TableColumn' :: TableColumn -> Maybe Text
$sel:format:TableColumn' :: TableColumn -> Maybe Format
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Format
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tableColumnId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tableColumnName