{-# 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.LendingSummary
-- 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.LendingSummary 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.DocumentGroup

-- | Contains information regarding DocumentGroups and
-- UndetectedDocumentTypes.
--
-- /See:/ 'newLendingSummary' smart constructor.
data LendingSummary = LendingSummary'
  { -- | Contains an array of all DocumentGroup objects.
    LendingSummary -> Maybe [DocumentGroup]
documentGroups :: Prelude.Maybe [DocumentGroup],
    -- | UndetectedDocumentTypes.
    LendingSummary -> Maybe [Text]
undetectedDocumentTypes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (LendingSummary -> LendingSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LendingSummary -> LendingSummary -> Bool
$c/= :: LendingSummary -> LendingSummary -> Bool
== :: LendingSummary -> LendingSummary -> Bool
$c== :: LendingSummary -> LendingSummary -> Bool
Prelude.Eq, ReadPrec [LendingSummary]
ReadPrec LendingSummary
Int -> ReadS LendingSummary
ReadS [LendingSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LendingSummary]
$creadListPrec :: ReadPrec [LendingSummary]
readPrec :: ReadPrec LendingSummary
$creadPrec :: ReadPrec LendingSummary
readList :: ReadS [LendingSummary]
$creadList :: ReadS [LendingSummary]
readsPrec :: Int -> ReadS LendingSummary
$creadsPrec :: Int -> ReadS LendingSummary
Prelude.Read, Int -> LendingSummary -> ShowS
[LendingSummary] -> ShowS
LendingSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LendingSummary] -> ShowS
$cshowList :: [LendingSummary] -> ShowS
show :: LendingSummary -> String
$cshow :: LendingSummary -> String
showsPrec :: Int -> LendingSummary -> ShowS
$cshowsPrec :: Int -> LendingSummary -> ShowS
Prelude.Show, forall x. Rep LendingSummary x -> LendingSummary
forall x. LendingSummary -> Rep LendingSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LendingSummary x -> LendingSummary
$cfrom :: forall x. LendingSummary -> Rep LendingSummary x
Prelude.Generic)

-- |
-- Create a value of 'LendingSummary' 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:
--
-- 'documentGroups', 'lendingSummary_documentGroups' - Contains an array of all DocumentGroup objects.
--
-- 'undetectedDocumentTypes', 'lendingSummary_undetectedDocumentTypes' - UndetectedDocumentTypes.
newLendingSummary ::
  LendingSummary
newLendingSummary :: LendingSummary
newLendingSummary =
  LendingSummary'
    { $sel:documentGroups:LendingSummary' :: Maybe [DocumentGroup]
documentGroups = forall a. Maybe a
Prelude.Nothing,
      $sel:undetectedDocumentTypes:LendingSummary' :: Maybe [Text]
undetectedDocumentTypes = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains an array of all DocumentGroup objects.
lendingSummary_documentGroups :: Lens.Lens' LendingSummary (Prelude.Maybe [DocumentGroup])
lendingSummary_documentGroups :: Lens' LendingSummary (Maybe [DocumentGroup])
lendingSummary_documentGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingSummary' {Maybe [DocumentGroup]
documentGroups :: Maybe [DocumentGroup]
$sel:documentGroups:LendingSummary' :: LendingSummary -> Maybe [DocumentGroup]
documentGroups} -> Maybe [DocumentGroup]
documentGroups) (\s :: LendingSummary
s@LendingSummary' {} Maybe [DocumentGroup]
a -> LendingSummary
s {$sel:documentGroups:LendingSummary' :: Maybe [DocumentGroup]
documentGroups = Maybe [DocumentGroup]
a} :: LendingSummary) 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

-- | UndetectedDocumentTypes.
lendingSummary_undetectedDocumentTypes :: Lens.Lens' LendingSummary (Prelude.Maybe [Prelude.Text])
lendingSummary_undetectedDocumentTypes :: Lens' LendingSummary (Maybe [Text])
lendingSummary_undetectedDocumentTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingSummary' {Maybe [Text]
undetectedDocumentTypes :: Maybe [Text]
$sel:undetectedDocumentTypes:LendingSummary' :: LendingSummary -> Maybe [Text]
undetectedDocumentTypes} -> Maybe [Text]
undetectedDocumentTypes) (\s :: LendingSummary
s@LendingSummary' {} Maybe [Text]
a -> LendingSummary
s {$sel:undetectedDocumentTypes:LendingSummary' :: Maybe [Text]
undetectedDocumentTypes = Maybe [Text]
a} :: LendingSummary) 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 LendingSummary where
  parseJSON :: Value -> Parser LendingSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LendingSummary"
      ( \Object
x ->
          Maybe [DocumentGroup] -> Maybe [Text] -> LendingSummary
LendingSummary'
            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
"DocumentGroups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"UndetectedDocumentTypes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable LendingSummary where
  hashWithSalt :: Int -> LendingSummary -> Int
hashWithSalt Int
_salt LendingSummary' {Maybe [Text]
Maybe [DocumentGroup]
undetectedDocumentTypes :: Maybe [Text]
documentGroups :: Maybe [DocumentGroup]
$sel:undetectedDocumentTypes:LendingSummary' :: LendingSummary -> Maybe [Text]
$sel:documentGroups:LendingSummary' :: LendingSummary -> Maybe [DocumentGroup]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DocumentGroup]
documentGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
undetectedDocumentTypes

instance Prelude.NFData LendingSummary where
  rnf :: LendingSummary -> ()
rnf LendingSummary' {Maybe [Text]
Maybe [DocumentGroup]
undetectedDocumentTypes :: Maybe [Text]
documentGroups :: Maybe [DocumentGroup]
$sel:undetectedDocumentTypes:LendingSummary' :: LendingSummary -> Maybe [Text]
$sel:documentGroups:LendingSummary' :: LendingSummary -> Maybe [DocumentGroup]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DocumentGroup]
documentGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
undetectedDocumentTypes