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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 word or line of text recognized by Amazon Textract
    ExpenseDetection -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
    -- | The confidence in detection, as a percentage
    ExpenseDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    ExpenseDetection -> Maybe Geometry
geometry :: Prelude.Maybe Geometry
  }
  deriving (ExpenseDetection -> ExpenseDetection -> Bool
(ExpenseDetection -> ExpenseDetection -> Bool)
-> (ExpenseDetection -> ExpenseDetection -> Bool)
-> Eq ExpenseDetection
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]
(Int -> ReadS ExpenseDetection)
-> ReadS [ExpenseDetection]
-> ReadPrec ExpenseDetection
-> ReadPrec [ExpenseDetection]
-> Read 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
(Int -> ExpenseDetection -> ShowS)
-> (ExpenseDetection -> String)
-> ([ExpenseDetection] -> ShowS)
-> Show ExpenseDetection
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. ExpenseDetection -> Rep ExpenseDetection x)
-> (forall x. Rep ExpenseDetection x -> ExpenseDetection)
-> Generic ExpenseDetection
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:
--
-- 'text', 'expenseDetection_text' - The word or line of text recognized by Amazon Textract
--
-- 'confidence', 'expenseDetection_confidence' - The confidence in detection, as a percentage
--
-- 'geometry', 'expenseDetection_geometry' - Undocumented member.
newExpenseDetection ::
  ExpenseDetection
newExpenseDetection :: ExpenseDetection
newExpenseDetection =
  ExpenseDetection' :: Maybe Text -> Maybe Double -> Maybe Geometry -> ExpenseDetection
ExpenseDetection'
    { $sel:text:ExpenseDetection' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ExpenseDetection' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:geometry:ExpenseDetection' :: Maybe Geometry
geometry = Maybe Geometry
forall a. Maybe a
Prelude.Nothing
    }

-- | The word or line of text recognized by Amazon Textract
expenseDetection_text :: Lens.Lens' ExpenseDetection (Prelude.Maybe Prelude.Text)
expenseDetection_text :: (Maybe Text -> f (Maybe Text))
-> ExpenseDetection -> f ExpenseDetection
expenseDetection_text = (ExpenseDetection -> Maybe Text)
-> (ExpenseDetection -> Maybe Text -> ExpenseDetection)
-> Lens ExpenseDetection ExpenseDetection (Maybe Text) (Maybe 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)

-- | The confidence in detection, as a percentage
expenseDetection_confidence :: Lens.Lens' ExpenseDetection (Prelude.Maybe Prelude.Double)
expenseDetection_confidence :: (Maybe Double -> f (Maybe Double))
-> ExpenseDetection -> f ExpenseDetection
expenseDetection_confidence = (ExpenseDetection -> Maybe Double)
-> (ExpenseDetection -> Maybe Double -> ExpenseDetection)
-> Lens
     ExpenseDetection ExpenseDetection (Maybe Double) (Maybe Double)
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 :: (Maybe Geometry -> f (Maybe Geometry))
-> ExpenseDetection -> f ExpenseDetection
expenseDetection_geometry = (ExpenseDetection -> Maybe Geometry)
-> (ExpenseDetection -> Maybe Geometry -> ExpenseDetection)
-> Lens
     ExpenseDetection ExpenseDetection (Maybe Geometry) (Maybe 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)

instance Core.FromJSON ExpenseDetection where
  parseJSON :: Value -> Parser ExpenseDetection
parseJSON =
    String
-> (Object -> Parser ExpenseDetection)
-> Value
-> Parser ExpenseDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExpenseDetection"
      ( \Object
x ->
          Maybe Text -> Maybe Double -> Maybe Geometry -> ExpenseDetection
ExpenseDetection'
            (Maybe Text -> Maybe Double -> Maybe Geometry -> ExpenseDetection)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Geometry -> ExpenseDetection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Text")
            Parser (Maybe Double -> Maybe Geometry -> ExpenseDetection)
-> Parser (Maybe Double)
-> Parser (Maybe Geometry -> ExpenseDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
            Parser (Maybe Geometry -> ExpenseDetection)
-> Parser (Maybe Geometry) -> Parser ExpenseDetection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Geometry)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Geometry")
      )

instance Prelude.Hashable ExpenseDetection

instance Prelude.NFData ExpenseDetection