{-# 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.ExpenseDetection
-- 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.ExpenseDetection 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

-- | An object used to store information about the Value or Label detected by
-- Amazon Textract.
--
-- /See:/ 'newExpenseDetection' smart constructor.
data ExpenseDetection = ExpenseDetection'
  { -- | The confidence in detection, as a percentage
    ExpenseDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    ExpenseDetection -> Maybe Geometry
geometry :: Prelude.Maybe Geometry,
    -- | The word or line of text recognized by Amazon Textract
    ExpenseDetection -> Maybe Text
text :: Prelude.Maybe Prelude.Text
  }
  deriving (ExpenseDetection -> ExpenseDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpenseDetection -> ExpenseDetection -> Bool
$c/= :: ExpenseDetection -> ExpenseDetection -> Bool
== :: ExpenseDetection -> ExpenseDetection -> Bool
$c== :: ExpenseDetection -> ExpenseDetection -> Bool
Prelude.Eq, ReadPrec [ExpenseDetection]
ReadPrec ExpenseDetection
Int -> ReadS ExpenseDetection
ReadS [ExpenseDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExpenseDetection]
$creadListPrec :: ReadPrec [ExpenseDetection]
readPrec :: ReadPrec ExpenseDetection
$creadPrec :: ReadPrec ExpenseDetection
readList :: ReadS [ExpenseDetection]
$creadList :: ReadS [ExpenseDetection]
readsPrec :: Int -> ReadS ExpenseDetection
$creadsPrec :: Int -> ReadS ExpenseDetection
Prelude.Read, Int -> ExpenseDetection -> ShowS
[ExpenseDetection] -> ShowS
ExpenseDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpenseDetection] -> ShowS
$cshowList :: [ExpenseDetection] -> ShowS
show :: ExpenseDetection -> String
$cshow :: ExpenseDetection -> String
showsPrec :: Int -> ExpenseDetection -> ShowS
$cshowsPrec :: Int -> ExpenseDetection -> ShowS
Prelude.Show, forall x. Rep ExpenseDetection x -> ExpenseDetection
forall x. ExpenseDetection -> Rep ExpenseDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExpenseDetection x -> ExpenseDetection
$cfrom :: forall x. ExpenseDetection -> Rep ExpenseDetection x
Prelude.Generic)

-- |
-- Create a value of 'ExpenseDetection' 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', 'expenseDetection_confidence' - The confidence in detection, as a percentage
--
-- 'geometry', 'expenseDetection_geometry' - Undocumented member.
--
-- 'text', 'expenseDetection_text' - The word or line of text recognized by Amazon Textract
newExpenseDetection ::
  ExpenseDetection
newExpenseDetection :: ExpenseDetection
newExpenseDetection =
  ExpenseDetection'
    { $sel:confidence:ExpenseDetection' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:geometry:ExpenseDetection' :: Maybe Geometry
geometry = forall a. Maybe a
Prelude.Nothing,
      $sel:text:ExpenseDetection' :: Maybe Text
text = forall a. Maybe a
Prelude.Nothing
    }

-- | The confidence in detection, as a percentage
expenseDetection_confidence :: Lens.Lens' ExpenseDetection (Prelude.Maybe Prelude.Double)
expenseDetection_confidence :: Lens' ExpenseDetection (Maybe Double)
expenseDetection_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseDetection' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ExpenseDetection' :: ExpenseDetection -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ExpenseDetection
s@ExpenseDetection' {} Maybe Double
a -> ExpenseDetection
s {$sel:confidence:ExpenseDetection' :: Maybe Double
confidence = Maybe Double
a} :: ExpenseDetection)

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

-- | The word or line of text recognized by Amazon Textract
expenseDetection_text :: Lens.Lens' ExpenseDetection (Prelude.Maybe Prelude.Text)
expenseDetection_text :: Lens' ExpenseDetection (Maybe Text)
expenseDetection_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseDetection' {Maybe Text
text :: Maybe Text
$sel:text:ExpenseDetection' :: ExpenseDetection -> Maybe Text
text} -> Maybe Text
text) (\s :: ExpenseDetection
s@ExpenseDetection' {} Maybe Text
a -> ExpenseDetection
s {$sel:text:ExpenseDetection' :: Maybe Text
text = Maybe Text
a} :: ExpenseDetection)

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

instance Prelude.Hashable ExpenseDetection where
  hashWithSalt :: Int -> ExpenseDetection -> Int
hashWithSalt Int
_salt ExpenseDetection' {Maybe Double
Maybe Text
Maybe Geometry
text :: Maybe Text
geometry :: Maybe Geometry
confidence :: Maybe Double
$sel:text:ExpenseDetection' :: ExpenseDetection -> Maybe Text
$sel:geometry:ExpenseDetection' :: ExpenseDetection -> Maybe Geometry
$sel:confidence:ExpenseDetection' :: ExpenseDetection -> 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 Text
text

instance Prelude.NFData ExpenseDetection where
  rnf :: ExpenseDetection -> ()
rnf ExpenseDetection' {Maybe Double
Maybe Text
Maybe Geometry
text :: Maybe Text
geometry :: Maybe Geometry
confidence :: Maybe Double
$sel:text:ExpenseDetection' :: ExpenseDetection -> Maybe Text
$sel:geometry:ExpenseDetection' :: ExpenseDetection -> Maybe Geometry
$sel:confidence:ExpenseDetection' :: ExpenseDetection -> 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 Text
text