{-# 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.Kendra.Types.TableRow
-- 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.Kendra.Types.TableRow where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.TableCell
import qualified Amazonka.Prelude as Prelude

-- | Information about a row in a table excerpt.
--
-- /See:/ 'newTableRow' smart constructor.
data TableRow = TableRow'
  { -- | A list of table cells in a row.
    TableRow -> Maybe [TableCell]
cells :: Prelude.Maybe [TableCell]
  }
  deriving (TableRow -> TableRow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableRow -> TableRow -> Bool
$c/= :: TableRow -> TableRow -> Bool
== :: TableRow -> TableRow -> Bool
$c== :: TableRow -> TableRow -> Bool
Prelude.Eq, ReadPrec [TableRow]
ReadPrec TableRow
Int -> ReadS TableRow
ReadS [TableRow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableRow]
$creadListPrec :: ReadPrec [TableRow]
readPrec :: ReadPrec TableRow
$creadPrec :: ReadPrec TableRow
readList :: ReadS [TableRow]
$creadList :: ReadS [TableRow]
readsPrec :: Int -> ReadS TableRow
$creadsPrec :: Int -> ReadS TableRow
Prelude.Read, Int -> TableRow -> ShowS
[TableRow] -> ShowS
TableRow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableRow] -> ShowS
$cshowList :: [TableRow] -> ShowS
show :: TableRow -> String
$cshow :: TableRow -> String
showsPrec :: Int -> TableRow -> ShowS
$cshowsPrec :: Int -> TableRow -> ShowS
Prelude.Show, forall x. Rep TableRow x -> TableRow
forall x. TableRow -> Rep TableRow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableRow x -> TableRow
$cfrom :: forall x. TableRow -> Rep TableRow x
Prelude.Generic)

-- |
-- Create a value of 'TableRow' 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:
--
-- 'cells', 'tableRow_cells' - A list of table cells in a row.
newTableRow ::
  TableRow
newTableRow :: TableRow
newTableRow = TableRow' {$sel:cells:TableRow' :: Maybe [TableCell]
cells = forall a. Maybe a
Prelude.Nothing}

-- | A list of table cells in a row.
tableRow_cells :: Lens.Lens' TableRow (Prelude.Maybe [TableCell])
tableRow_cells :: Lens' TableRow (Maybe [TableCell])
tableRow_cells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableRow' {Maybe [TableCell]
cells :: Maybe [TableCell]
$sel:cells:TableRow' :: TableRow -> Maybe [TableCell]
cells} -> Maybe [TableCell]
cells) (\s :: TableRow
s@TableRow' {} Maybe [TableCell]
a -> TableRow
s {$sel:cells:TableRow' :: Maybe [TableCell]
cells = Maybe [TableCell]
a} :: TableRow) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON TableRow where
  parseJSON :: Value -> Parser TableRow
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableRow"
      ( \Object
x ->
          Maybe [TableCell] -> TableRow
TableRow'
            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
"Cells" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TableRow where
  hashWithSalt :: Int -> TableRow -> Int
hashWithSalt Int
_salt TableRow' {Maybe [TableCell]
cells :: Maybe [TableCell]
$sel:cells:TableRow' :: TableRow -> Maybe [TableCell]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TableCell]
cells

instance Prelude.NFData TableRow where
  rnf :: TableRow -> ()
rnf TableRow' {Maybe [TableCell]
cells :: Maybe [TableCell]
$sel:cells:TableRow' :: TableRow -> Maybe [TableCell]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [TableCell]
cells