{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.HoneyCode.Types.TableColumn where

import qualified Amazonka.Core as Core
import Amazonka.HoneyCode.Types.Format
import qualified Amazonka.Lens as Lens
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 name of the column in the table.
    TableColumn -> Maybe Text
tableColumnName :: Prelude.Maybe Prelude.Text,
    -- | The id of the column in the table.
    TableColumn -> Maybe Text
tableColumnId :: Prelude.Maybe Prelude.Text
  }
  deriving (TableColumn -> TableColumn -> Bool
(TableColumn -> TableColumn -> Bool)
-> (TableColumn -> TableColumn -> Bool) -> Eq TableColumn
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]
(Int -> ReadS TableColumn)
-> ReadS [TableColumn]
-> ReadPrec TableColumn
-> ReadPrec [TableColumn]
-> Read 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
(Int -> TableColumn -> ShowS)
-> (TableColumn -> String)
-> ([TableColumn] -> ShowS)
-> Show TableColumn
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. TableColumn -> Rep TableColumn x)
-> (forall x. Rep TableColumn x -> TableColumn)
-> Generic TableColumn
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\'.
--
-- 'tableColumnName', 'tableColumn_tableColumnName' - The name of the column in the table.
--
-- 'tableColumnId', 'tableColumn_tableColumnId' - The id of the column in the table.
newTableColumn ::
  TableColumn
newTableColumn :: TableColumn
newTableColumn =
  TableColumn' :: Maybe Format -> Maybe Text -> Maybe Text -> TableColumn
TableColumn'
    { $sel:format:TableColumn' :: Maybe Format
format = Maybe Format
forall a. Maybe a
Prelude.Nothing,
      $sel:tableColumnName:TableColumn' :: Maybe Text
tableColumnName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableColumnId:TableColumn' :: Maybe Text
tableColumnId = Maybe Text
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 :: (Maybe Format -> f (Maybe Format)) -> TableColumn -> f TableColumn
tableColumn_format = (TableColumn -> Maybe Format)
-> (TableColumn -> Maybe Format -> TableColumn)
-> Lens TableColumn TableColumn (Maybe Format) (Maybe 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 name of the column in the table.
tableColumn_tableColumnName :: Lens.Lens' TableColumn (Prelude.Maybe Prelude.Text)
tableColumn_tableColumnName :: (Maybe Text -> f (Maybe Text)) -> TableColumn -> f TableColumn
tableColumn_tableColumnName = (TableColumn -> Maybe Text)
-> (TableColumn -> Maybe Text -> TableColumn)
-> Lens TableColumn TableColumn (Maybe Text) (Maybe Text)
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)

-- | The id of the column in the table.
tableColumn_tableColumnId :: Lens.Lens' TableColumn (Prelude.Maybe Prelude.Text)
tableColumn_tableColumnId :: (Maybe Text -> f (Maybe Text)) -> TableColumn -> f TableColumn
tableColumn_tableColumnId = (TableColumn -> Maybe Text)
-> (TableColumn -> Maybe Text -> TableColumn)
-> Lens TableColumn TableColumn (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON TableColumn where
  parseJSON :: Value -> Parser TableColumn
parseJSON =
    String
-> (Object -> Parser TableColumn) -> Value -> Parser TableColumn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TableColumn"
      ( \Object
x ->
          Maybe Format -> Maybe Text -> Maybe Text -> TableColumn
TableColumn'
            (Maybe Format -> Maybe Text -> Maybe Text -> TableColumn)
-> Parser (Maybe Format)
-> Parser (Maybe Text -> Maybe Text -> TableColumn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Format)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"format")
            Parser (Maybe Text -> Maybe Text -> TableColumn)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TableColumn)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tableColumnName")
            Parser (Maybe Text -> TableColumn)
-> Parser (Maybe Text) -> Parser TableColumn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tableColumnId")
      )

instance Prelude.Hashable TableColumn

instance Prelude.NFData TableColumn