{-# 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.LendingDetection
-- 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.LendingDetection 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.Geometry
import Amazonka.Textract.Types.SelectionStatus

-- | The results extracted for a lending document.
--
-- /See:/ 'newLendingDetection' smart constructor.
data LendingDetection = LendingDetection'
  { -- | The confidence level for the text of a detected value in a lending
    -- document.
    LendingDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    LendingDetection -> Maybe Geometry
geometry :: Prelude.Maybe Geometry,
    -- | The selection status of a selection element, such as an option button or
    -- check box.
    LendingDetection -> Maybe SelectionStatus
selectionStatus :: Prelude.Maybe SelectionStatus,
    -- | The text extracted for a detected value in a lending document.
    LendingDetection -> Maybe Text
text :: Prelude.Maybe Prelude.Text
  }
  deriving (LendingDetection -> LendingDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LendingDetection -> LendingDetection -> Bool
$c/= :: LendingDetection -> LendingDetection -> Bool
== :: LendingDetection -> LendingDetection -> Bool
$c== :: LendingDetection -> LendingDetection -> Bool
Prelude.Eq, ReadPrec [LendingDetection]
ReadPrec LendingDetection
Int -> ReadS LendingDetection
ReadS [LendingDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LendingDetection]
$creadListPrec :: ReadPrec [LendingDetection]
readPrec :: ReadPrec LendingDetection
$creadPrec :: ReadPrec LendingDetection
readList :: ReadS [LendingDetection]
$creadList :: ReadS [LendingDetection]
readsPrec :: Int -> ReadS LendingDetection
$creadsPrec :: Int -> ReadS LendingDetection
Prelude.Read, Int -> LendingDetection -> ShowS
[LendingDetection] -> ShowS
LendingDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LendingDetection] -> ShowS
$cshowList :: [LendingDetection] -> ShowS
show :: LendingDetection -> String
$cshow :: LendingDetection -> String
showsPrec :: Int -> LendingDetection -> ShowS
$cshowsPrec :: Int -> LendingDetection -> ShowS
Prelude.Show, forall x. Rep LendingDetection x -> LendingDetection
forall x. LendingDetection -> Rep LendingDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LendingDetection x -> LendingDetection
$cfrom :: forall x. LendingDetection -> Rep LendingDetection x
Prelude.Generic)

-- |
-- Create a value of 'LendingDetection' 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:
--
-- 'confidence', 'lendingDetection_confidence' - The confidence level for the text of a detected value in a lending
-- document.
--
-- 'geometry', 'lendingDetection_geometry' - Undocumented member.
--
-- 'selectionStatus', 'lendingDetection_selectionStatus' - The selection status of a selection element, such as an option button or
-- check box.
--
-- 'text', 'lendingDetection_text' - The text extracted for a detected value in a lending document.
newLendingDetection ::
  LendingDetection
newLendingDetection :: LendingDetection
newLendingDetection =
  LendingDetection'
    { $sel:confidence:LendingDetection' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:geometry:LendingDetection' :: Maybe Geometry
geometry = forall a. Maybe a
Prelude.Nothing,
      $sel:selectionStatus:LendingDetection' :: Maybe SelectionStatus
selectionStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:text:LendingDetection' :: Maybe Text
text = forall a. Maybe a
Prelude.Nothing
    }

-- | The confidence level for the text of a detected value in a lending
-- document.
lendingDetection_confidence :: Lens.Lens' LendingDetection (Prelude.Maybe Prelude.Double)
lendingDetection_confidence :: Lens' LendingDetection (Maybe Double)
lendingDetection_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingDetection' {Maybe Double
confidence :: Maybe Double
$sel:confidence:LendingDetection' :: LendingDetection -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: LendingDetection
s@LendingDetection' {} Maybe Double
a -> LendingDetection
s {$sel:confidence:LendingDetection' :: Maybe Double
confidence = Maybe Double
a} :: LendingDetection)

-- | Undocumented member.
lendingDetection_geometry :: Lens.Lens' LendingDetection (Prelude.Maybe Geometry)
lendingDetection_geometry :: Lens' LendingDetection (Maybe Geometry)
lendingDetection_geometry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingDetection' {Maybe Geometry
geometry :: Maybe Geometry
$sel:geometry:LendingDetection' :: LendingDetection -> Maybe Geometry
geometry} -> Maybe Geometry
geometry) (\s :: LendingDetection
s@LendingDetection' {} Maybe Geometry
a -> LendingDetection
s {$sel:geometry:LendingDetection' :: Maybe Geometry
geometry = Maybe Geometry
a} :: LendingDetection)

-- | The selection status of a selection element, such as an option button or
-- check box.
lendingDetection_selectionStatus :: Lens.Lens' LendingDetection (Prelude.Maybe SelectionStatus)
lendingDetection_selectionStatus :: Lens' LendingDetection (Maybe SelectionStatus)
lendingDetection_selectionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingDetection' {Maybe SelectionStatus
selectionStatus :: Maybe SelectionStatus
$sel:selectionStatus:LendingDetection' :: LendingDetection -> Maybe SelectionStatus
selectionStatus} -> Maybe SelectionStatus
selectionStatus) (\s :: LendingDetection
s@LendingDetection' {} Maybe SelectionStatus
a -> LendingDetection
s {$sel:selectionStatus:LendingDetection' :: Maybe SelectionStatus
selectionStatus = Maybe SelectionStatus
a} :: LendingDetection)

-- | The text extracted for a detected value in a lending document.
lendingDetection_text :: Lens.Lens' LendingDetection (Prelude.Maybe Prelude.Text)
lendingDetection_text :: Lens' LendingDetection (Maybe Text)
lendingDetection_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LendingDetection' {Maybe Text
text :: Maybe Text
$sel:text:LendingDetection' :: LendingDetection -> Maybe Text
text} -> Maybe Text
text) (\s :: LendingDetection
s@LendingDetection' {} Maybe Text
a -> LendingDetection
s {$sel:text:LendingDetection' :: Maybe Text
text = Maybe Text
a} :: LendingDetection)

instance Data.FromJSON LendingDetection where
  parseJSON :: Value -> Parser LendingDetection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LendingDetection"
      ( \Object
x ->
          Maybe Double
-> Maybe Geometry
-> Maybe SelectionStatus
-> Maybe Text
-> LendingDetection
LendingDetection'
            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
"Confidence")
            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
"Geometry")
            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
"SelectionStatus")
            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
"Text")
      )

instance Prelude.Hashable LendingDetection where
  hashWithSalt :: Int -> LendingDetection -> Int
hashWithSalt Int
_salt LendingDetection' {Maybe Double
Maybe Text
Maybe Geometry
Maybe SelectionStatus
text :: Maybe Text
selectionStatus :: Maybe SelectionStatus
geometry :: Maybe Geometry
confidence :: Maybe Double
$sel:text:LendingDetection' :: LendingDetection -> Maybe Text
$sel:selectionStatus:LendingDetection' :: LendingDetection -> Maybe SelectionStatus
$sel:geometry:LendingDetection' :: LendingDetection -> Maybe Geometry
$sel:confidence:LendingDetection' :: LendingDetection -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Geometry
geometry
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SelectionStatus
selectionStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
text

instance Prelude.NFData LendingDetection where
  rnf :: LendingDetection -> ()
rnf LendingDetection' {Maybe Double
Maybe Text
Maybe Geometry
Maybe SelectionStatus
text :: Maybe Text
selectionStatus :: Maybe SelectionStatus
geometry :: Maybe Geometry
confidence :: Maybe Double
$sel:text:LendingDetection' :: LendingDetection -> Maybe Text
$sel:selectionStatus:LendingDetection' :: LendingDetection -> Maybe SelectionStatus
$sel:geometry:LendingDetection' :: LendingDetection -> Maybe Geometry
$sel:confidence:LendingDetection' :: LendingDetection -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Geometry
geometry
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SelectionStatus
selectionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
text