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

-- | An object representing the properties of a table in a workbook.
--
-- /See:/ 'newTable' smart constructor.
data Table = Table'
  { -- | The id of the table.
    Table -> Maybe Text
tableId :: Prelude.Maybe Prelude.Text,
    -- | The name of the table.
    Table -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text
  }
  deriving (Table -> Table -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Table -> Table -> Bool
$c/= :: Table -> Table -> Bool
== :: Table -> Table -> Bool
$c== :: Table -> Table -> Bool
Prelude.Eq, ReadPrec [Table]
ReadPrec Table
Int -> ReadS Table
ReadS [Table]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Table]
$creadListPrec :: ReadPrec [Table]
readPrec :: ReadPrec Table
$creadPrec :: ReadPrec Table
readList :: ReadS [Table]
$creadList :: ReadS [Table]
readsPrec :: Int -> ReadS Table
$creadsPrec :: Int -> ReadS Table
Prelude.Read, Int -> Table -> ShowS
[Table] -> ShowS
Table -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Table] -> ShowS
$cshowList :: [Table] -> ShowS
show :: Table -> String
$cshow :: Table -> String
showsPrec :: Int -> Table -> ShowS
$cshowsPrec :: Int -> Table -> ShowS
Prelude.Show, forall x. Rep Table x -> Table
forall x. Table -> Rep Table x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Table x -> Table
$cfrom :: forall x. Table -> Rep Table x
Prelude.Generic)

-- |
-- Create a value of 'Table' 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:
--
-- 'tableId', 'table_tableId' - The id of the table.
--
-- 'tableName', 'table_tableName' - The name of the table.
newTable ::
  Table
newTable :: Table
newTable =
  Table'
    { $sel:tableId:Table' :: Maybe Text
tableId = forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:Table' :: Maybe Text
tableName = forall a. Maybe a
Prelude.Nothing
    }

-- | The id of the table.
table_tableId :: Lens.Lens' Table (Prelude.Maybe Prelude.Text)
table_tableId :: Lens' Table (Maybe Text)
table_tableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Table' {Maybe Text
tableId :: Maybe Text
$sel:tableId:Table' :: Table -> Maybe Text
tableId} -> Maybe Text
tableId) (\s :: Table
s@Table' {} Maybe Text
a -> Table
s {$sel:tableId:Table' :: Maybe Text
tableId = Maybe Text
a} :: Table)

-- | The name of the table.
table_tableName :: Lens.Lens' Table (Prelude.Maybe Prelude.Text)
table_tableName :: Lens' Table (Maybe Text)
table_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Table' {Maybe Text
tableName :: Maybe Text
$sel:tableName:Table' :: Table -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: Table
s@Table' {} Maybe Text
a -> Table
s {$sel:tableName:Table' :: Maybe Text
tableName = Maybe Text
a} :: Table)

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

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

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