{-# 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 #-}
module Amazonka.Textract.Types.ExpenseDocument where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Textract.Types.ExpenseField
import Amazonka.Textract.Types.LineItemGroup
data ExpenseDocument = ExpenseDocument'
{
ExpenseDocument -> Maybe [LineItemGroup]
lineItemGroups :: Prelude.Maybe [LineItemGroup],
ExpenseDocument -> Maybe [ExpenseField]
summaryFields :: Prelude.Maybe [ExpenseField],
ExpenseDocument -> Maybe Natural
expenseIndex :: Prelude.Maybe Prelude.Natural
}
deriving (ExpenseDocument -> ExpenseDocument -> Bool
(ExpenseDocument -> ExpenseDocument -> Bool)
-> (ExpenseDocument -> ExpenseDocument -> Bool)
-> Eq ExpenseDocument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpenseDocument -> ExpenseDocument -> Bool
$c/= :: ExpenseDocument -> ExpenseDocument -> Bool
== :: ExpenseDocument -> ExpenseDocument -> Bool
$c== :: ExpenseDocument -> ExpenseDocument -> Bool
Prelude.Eq, ReadPrec [ExpenseDocument]
ReadPrec ExpenseDocument
Int -> ReadS ExpenseDocument
ReadS [ExpenseDocument]
(Int -> ReadS ExpenseDocument)
-> ReadS [ExpenseDocument]
-> ReadPrec ExpenseDocument
-> ReadPrec [ExpenseDocument]
-> Read ExpenseDocument
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExpenseDocument]
$creadListPrec :: ReadPrec [ExpenseDocument]
readPrec :: ReadPrec ExpenseDocument
$creadPrec :: ReadPrec ExpenseDocument
readList :: ReadS [ExpenseDocument]
$creadList :: ReadS [ExpenseDocument]
readsPrec :: Int -> ReadS ExpenseDocument
$creadsPrec :: Int -> ReadS ExpenseDocument
Prelude.Read, Int -> ExpenseDocument -> ShowS
[ExpenseDocument] -> ShowS
ExpenseDocument -> String
(Int -> ExpenseDocument -> ShowS)
-> (ExpenseDocument -> String)
-> ([ExpenseDocument] -> ShowS)
-> Show ExpenseDocument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpenseDocument] -> ShowS
$cshowList :: [ExpenseDocument] -> ShowS
show :: ExpenseDocument -> String
$cshow :: ExpenseDocument -> String
showsPrec :: Int -> ExpenseDocument -> ShowS
$cshowsPrec :: Int -> ExpenseDocument -> ShowS
Prelude.Show, (forall x. ExpenseDocument -> Rep ExpenseDocument x)
-> (forall x. Rep ExpenseDocument x -> ExpenseDocument)
-> Generic ExpenseDocument
forall x. Rep ExpenseDocument x -> ExpenseDocument
forall x. ExpenseDocument -> Rep ExpenseDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExpenseDocument x -> ExpenseDocument
$cfrom :: forall x. ExpenseDocument -> Rep ExpenseDocument x
Prelude.Generic)
newExpenseDocument ::
ExpenseDocument
newExpenseDocument :: ExpenseDocument
newExpenseDocument =
ExpenseDocument' :: Maybe [LineItemGroup]
-> Maybe [ExpenseField] -> Maybe Natural -> ExpenseDocument
ExpenseDocument'
{ $sel:lineItemGroups:ExpenseDocument' :: Maybe [LineItemGroup]
lineItemGroups = Maybe [LineItemGroup]
forall a. Maybe a
Prelude.Nothing,
$sel:summaryFields:ExpenseDocument' :: Maybe [ExpenseField]
summaryFields = Maybe [ExpenseField]
forall a. Maybe a
Prelude.Nothing,
$sel:expenseIndex:ExpenseDocument' :: Maybe Natural
expenseIndex = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
expenseDocument_lineItemGroups :: Lens.Lens' ExpenseDocument (Prelude.Maybe [LineItemGroup])
expenseDocument_lineItemGroups :: (Maybe [LineItemGroup] -> f (Maybe [LineItemGroup]))
-> ExpenseDocument -> f ExpenseDocument
expenseDocument_lineItemGroups = (ExpenseDocument -> Maybe [LineItemGroup])
-> (ExpenseDocument -> Maybe [LineItemGroup] -> ExpenseDocument)
-> Lens
ExpenseDocument
ExpenseDocument
(Maybe [LineItemGroup])
(Maybe [LineItemGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseDocument' {Maybe [LineItemGroup]
lineItemGroups :: Maybe [LineItemGroup]
$sel:lineItemGroups:ExpenseDocument' :: ExpenseDocument -> Maybe [LineItemGroup]
lineItemGroups} -> Maybe [LineItemGroup]
lineItemGroups) (\s :: ExpenseDocument
s@ExpenseDocument' {} Maybe [LineItemGroup]
a -> ExpenseDocument
s {$sel:lineItemGroups:ExpenseDocument' :: Maybe [LineItemGroup]
lineItemGroups = Maybe [LineItemGroup]
a} :: ExpenseDocument) ((Maybe [LineItemGroup] -> f (Maybe [LineItemGroup]))
-> ExpenseDocument -> f ExpenseDocument)
-> ((Maybe [LineItemGroup] -> f (Maybe [LineItemGroup]))
-> Maybe [LineItemGroup] -> f (Maybe [LineItemGroup]))
-> (Maybe [LineItemGroup] -> f (Maybe [LineItemGroup]))
-> ExpenseDocument
-> f ExpenseDocument
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LineItemGroup] [LineItemGroup] [LineItemGroup] [LineItemGroup]
-> Iso
(Maybe [LineItemGroup])
(Maybe [LineItemGroup])
(Maybe [LineItemGroup])
(Maybe [LineItemGroup])
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
[LineItemGroup] [LineItemGroup] [LineItemGroup] [LineItemGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
expenseDocument_summaryFields :: Lens.Lens' ExpenseDocument (Prelude.Maybe [ExpenseField])
expenseDocument_summaryFields :: (Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> ExpenseDocument -> f ExpenseDocument
expenseDocument_summaryFields = (ExpenseDocument -> Maybe [ExpenseField])
-> (ExpenseDocument -> Maybe [ExpenseField] -> ExpenseDocument)
-> Lens
ExpenseDocument
ExpenseDocument
(Maybe [ExpenseField])
(Maybe [ExpenseField])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseDocument' {Maybe [ExpenseField]
summaryFields :: Maybe [ExpenseField]
$sel:summaryFields:ExpenseDocument' :: ExpenseDocument -> Maybe [ExpenseField]
summaryFields} -> Maybe [ExpenseField]
summaryFields) (\s :: ExpenseDocument
s@ExpenseDocument' {} Maybe [ExpenseField]
a -> ExpenseDocument
s {$sel:summaryFields:ExpenseDocument' :: Maybe [ExpenseField]
summaryFields = Maybe [ExpenseField]
a} :: ExpenseDocument) ((Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> ExpenseDocument -> f ExpenseDocument)
-> ((Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> (Maybe [ExpenseField] -> f (Maybe [ExpenseField]))
-> ExpenseDocument
-> f ExpenseDocument
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
expenseDocument_expenseIndex :: Lens.Lens' ExpenseDocument (Prelude.Maybe Prelude.Natural)
expenseDocument_expenseIndex :: (Maybe Natural -> f (Maybe Natural))
-> ExpenseDocument -> f ExpenseDocument
expenseDocument_expenseIndex = (ExpenseDocument -> Maybe Natural)
-> (ExpenseDocument -> Maybe Natural -> ExpenseDocument)
-> Lens
ExpenseDocument ExpenseDocument (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseDocument' {Maybe Natural
expenseIndex :: Maybe Natural
$sel:expenseIndex:ExpenseDocument' :: ExpenseDocument -> Maybe Natural
expenseIndex} -> Maybe Natural
expenseIndex) (\s :: ExpenseDocument
s@ExpenseDocument' {} Maybe Natural
a -> ExpenseDocument
s {$sel:expenseIndex:ExpenseDocument' :: Maybe Natural
expenseIndex = Maybe Natural
a} :: ExpenseDocument)
instance Core.FromJSON ExpenseDocument where
parseJSON :: Value -> Parser ExpenseDocument
parseJSON =
String
-> (Object -> Parser ExpenseDocument)
-> Value
-> Parser ExpenseDocument
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ExpenseDocument"
( \Object
x ->
Maybe [LineItemGroup]
-> Maybe [ExpenseField] -> Maybe Natural -> ExpenseDocument
ExpenseDocument'
(Maybe [LineItemGroup]
-> Maybe [ExpenseField] -> Maybe Natural -> ExpenseDocument)
-> Parser (Maybe [LineItemGroup])
-> Parser
(Maybe [ExpenseField] -> Maybe Natural -> ExpenseDocument)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [LineItemGroup]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LineItemGroups" Parser (Maybe (Maybe [LineItemGroup]))
-> Maybe [LineItemGroup] -> Parser (Maybe [LineItemGroup])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LineItemGroup]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [ExpenseField] -> Maybe Natural -> ExpenseDocument)
-> Parser (Maybe [ExpenseField])
-> Parser (Maybe Natural -> ExpenseDocument)
forall (f :: * -> *) a b. Applicative f => 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
"SummaryFields" 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)
Parser (Maybe Natural -> ExpenseDocument)
-> Parser (Maybe Natural) -> Parser ExpenseDocument
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExpenseIndex")
)
instance Prelude.Hashable ExpenseDocument
instance Prelude.NFData ExpenseDocument