{-# 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-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.Textract.Types.LineItemFields where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LineItemFields -> LineItemFields -> Bool)
-> (LineItemFields -> LineItemFields -> Bool) -> Eq LineItemFields
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]
(Int -> ReadS LineItemFields)
-> ReadS [LineItemFields]
-> ReadPrec LineItemFields
-> ReadPrec [LineItemFields]
-> Read 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
(Int -> LineItemFields -> ShowS)
-> (LineItemFields -> String)
-> ([LineItemFields] -> ShowS)
-> Show LineItemFields
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. LineItemFields -> Rep LineItemFields x)
-> (forall x. Rep LineItemFields x -> LineItemFields)
-> Generic LineItemFields
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' :: Maybe [ExpenseField] -> LineItemFields
LineItemFields'
    { $sel:lineItemExpenseFields:LineItemFields' :: Maybe [ExpenseField]
lineItemExpenseFields =
        Maybe [ExpenseField]
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 :: (Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> LineItemFields -> f LineItemFields
lineItemFields_lineItemExpenseFields = (LineItemFields -> Maybe [ExpenseField])
-> (LineItemFields -> Maybe [ExpenseField] -> LineItemFields)
-> Lens
     LineItemFields
     LineItemFields
     (Maybe [ExpenseField])
     (Maybe [ExpenseField])
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) ((Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
 -> LineItemFields -> f LineItemFields)
-> ((Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
    -> Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> (Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> LineItemFields
-> f LineItemFields
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ExpenseField] [ExpenseField] [ExpenseField] [ExpenseField]
-> Iso
     (Maybe [ExpenseField])
     (Maybe [ExpenseField])
     (Maybe [ExpenseField])
     (Maybe [ExpenseField])
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 AnIso [ExpenseField] [ExpenseField] [ExpenseField] [ExpenseField]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON LineItemFields where
  parseJSON :: Value -> Parser LineItemFields
parseJSON =
    String
-> (Object -> Parser LineItemFields)
-> Value
-> Parser LineItemFields
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LineItemFields"
      ( \Object
x ->
          Maybe [ExpenseField] -> LineItemFields
LineItemFields'
            (Maybe [ExpenseField] -> LineItemFields)
-> Parser (Maybe [ExpenseField]) -> Parser LineItemFields
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ExpenseField]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LineItemExpenseFields"
                            Parser (Maybe (Maybe [ExpenseField]))
-> Maybe [ExpenseField] -> Parser (Maybe [ExpenseField])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ExpenseField]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable LineItemFields

instance Prelude.NFData LineItemFields