{-# 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.Textract.Types.LineItemFields
-- 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.Textract.Types.LineItemFields 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
import Amazonka.Textract.Types.ExpenseField

-- | A structure that holds information about the different lines found in a
-- document\'s tables.
--
-- /See:/ 'newLineItemFields' smart constructor.
data LineItemFields = LineItemFields'
  { -- | ExpenseFields used to show information from detected lines on a table.
    LineItemFields -> Maybe [ExpenseField]
lineItemExpenseFields :: Prelude.Maybe [ExpenseField]
  }
  deriving (LineItemFields -> LineItemFields -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemFields -> LineItemFields -> Bool
$c/= :: LineItemFields -> LineItemFields -> Bool
== :: LineItemFields -> LineItemFields -> Bool
$c== :: LineItemFields -> LineItemFields -> Bool
Prelude.Eq, ReadPrec [LineItemFields]
ReadPrec LineItemFields
Int -> ReadS LineItemFields
ReadS [LineItemFields]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LineItemFields]
$creadListPrec :: ReadPrec [LineItemFields]
readPrec :: ReadPrec LineItemFields
$creadPrec :: ReadPrec LineItemFields
readList :: ReadS [LineItemFields]
$creadList :: ReadS [LineItemFields]
readsPrec :: Int -> ReadS LineItemFields
$creadsPrec :: Int -> ReadS LineItemFields
Prelude.Read, Int -> LineItemFields -> ShowS
[LineItemFields] -> ShowS
LineItemFields -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemFields] -> ShowS
$cshowList :: [LineItemFields] -> ShowS
show :: LineItemFields -> String
$cshow :: LineItemFields -> String
showsPrec :: Int -> LineItemFields -> ShowS
$cshowsPrec :: Int -> LineItemFields -> ShowS
Prelude.Show, forall x. Rep LineItemFields x -> LineItemFields
forall x. LineItemFields -> Rep LineItemFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LineItemFields x -> LineItemFields
$cfrom :: forall x. LineItemFields -> Rep LineItemFields x
Prelude.Generic)

-- |
-- Create a value of 'LineItemFields' 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:
--
-- 'lineItemExpenseFields', 'lineItemFields_lineItemExpenseFields' - ExpenseFields used to show information from detected lines on a table.
newLineItemFields ::
  LineItemFields
newLineItemFields :: LineItemFields
newLineItemFields =
  LineItemFields'
    { $sel:lineItemExpenseFields:LineItemFields' :: Maybe [ExpenseField]
lineItemExpenseFields =
        forall a. Maybe a
Prelude.Nothing
    }

-- | ExpenseFields used to show information from detected lines on a table.
lineItemFields_lineItemExpenseFields :: Lens.Lens' LineItemFields (Prelude.Maybe [ExpenseField])
lineItemFields_lineItemExpenseFields :: Lens' LineItemFields (Maybe [ExpenseField])
lineItemFields_lineItemExpenseFields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItemFields' {Maybe [ExpenseField]
lineItemExpenseFields :: Maybe [ExpenseField]
$sel:lineItemExpenseFields:LineItemFields' :: LineItemFields -> Maybe [ExpenseField]
lineItemExpenseFields} -> Maybe [ExpenseField]
lineItemExpenseFields) (\s :: LineItemFields
s@LineItemFields' {} Maybe [ExpenseField]
a -> LineItemFields
s {$sel:lineItemExpenseFields:LineItemFields' :: Maybe [ExpenseField]
lineItemExpenseFields = Maybe [ExpenseField]
a} :: LineItemFields) 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 LineItemFields where
  parseJSON :: Value -> Parser LineItemFields
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LineItemFields"
      ( \Object
x ->
          Maybe [ExpenseField] -> LineItemFields
LineItemFields'
            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
"LineItemExpenseFields"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable LineItemFields where
  hashWithSalt :: Int -> LineItemFields -> Int
hashWithSalt Int
_salt LineItemFields' {Maybe [ExpenseField]
lineItemExpenseFields :: Maybe [ExpenseField]
$sel:lineItemExpenseFields:LineItemFields' :: LineItemFields -> Maybe [ExpenseField]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ExpenseField]
lineItemExpenseFields

instance Prelude.NFData LineItemFields where
  rnf :: LineItemFields -> ()
rnf LineItemFields' {Maybe [ExpenseField]
lineItemExpenseFields :: Maybe [ExpenseField]
$sel:lineItemExpenseFields:LineItemFields' :: LineItemFields -> Maybe [ExpenseField]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ExpenseField]
lineItemExpenseFields