{-# 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.ExpenseType where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ExpenseType = ExpenseType'
{
ExpenseType -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
ExpenseType -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double
}
deriving (ExpenseType -> ExpenseType -> Bool
(ExpenseType -> ExpenseType -> Bool)
-> (ExpenseType -> ExpenseType -> Bool) -> Eq ExpenseType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpenseType -> ExpenseType -> Bool
$c/= :: ExpenseType -> ExpenseType -> Bool
== :: ExpenseType -> ExpenseType -> Bool
$c== :: ExpenseType -> ExpenseType -> Bool
Prelude.Eq, ReadPrec [ExpenseType]
ReadPrec ExpenseType
Int -> ReadS ExpenseType
ReadS [ExpenseType]
(Int -> ReadS ExpenseType)
-> ReadS [ExpenseType]
-> ReadPrec ExpenseType
-> ReadPrec [ExpenseType]
-> Read ExpenseType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExpenseType]
$creadListPrec :: ReadPrec [ExpenseType]
readPrec :: ReadPrec ExpenseType
$creadPrec :: ReadPrec ExpenseType
readList :: ReadS [ExpenseType]
$creadList :: ReadS [ExpenseType]
readsPrec :: Int -> ReadS ExpenseType
$creadsPrec :: Int -> ReadS ExpenseType
Prelude.Read, Int -> ExpenseType -> ShowS
[ExpenseType] -> ShowS
ExpenseType -> String
(Int -> ExpenseType -> ShowS)
-> (ExpenseType -> String)
-> ([ExpenseType] -> ShowS)
-> Show ExpenseType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpenseType] -> ShowS
$cshowList :: [ExpenseType] -> ShowS
show :: ExpenseType -> String
$cshow :: ExpenseType -> String
showsPrec :: Int -> ExpenseType -> ShowS
$cshowsPrec :: Int -> ExpenseType -> ShowS
Prelude.Show, (forall x. ExpenseType -> Rep ExpenseType x)
-> (forall x. Rep ExpenseType x -> ExpenseType)
-> Generic ExpenseType
forall x. Rep ExpenseType x -> ExpenseType
forall x. ExpenseType -> Rep ExpenseType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExpenseType x -> ExpenseType
$cfrom :: forall x. ExpenseType -> Rep ExpenseType x
Prelude.Generic)
newExpenseType ::
ExpenseType
newExpenseType :: ExpenseType
newExpenseType =
ExpenseType' :: Maybe Text -> Maybe Double -> ExpenseType
ExpenseType'
{ $sel:text:ExpenseType' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:confidence:ExpenseType' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
expenseType_text :: Lens.Lens' ExpenseType (Prelude.Maybe Prelude.Text)
expenseType_text :: (Maybe Text -> f (Maybe Text)) -> ExpenseType -> f ExpenseType
expenseType_text = (ExpenseType -> Maybe Text)
-> (ExpenseType -> Maybe Text -> ExpenseType)
-> Lens ExpenseType ExpenseType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseType' {Maybe Text
text :: Maybe Text
$sel:text:ExpenseType' :: ExpenseType -> Maybe Text
text} -> Maybe Text
text) (\s :: ExpenseType
s@ExpenseType' {} Maybe Text
a -> ExpenseType
s {$sel:text:ExpenseType' :: Maybe Text
text = Maybe Text
a} :: ExpenseType)
expenseType_confidence :: Lens.Lens' ExpenseType (Prelude.Maybe Prelude.Double)
expenseType_confidence :: (Maybe Double -> f (Maybe Double)) -> ExpenseType -> f ExpenseType
expenseType_confidence = (ExpenseType -> Maybe Double)
-> (ExpenseType -> Maybe Double -> ExpenseType)
-> Lens ExpenseType ExpenseType (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpenseType' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ExpenseType' :: ExpenseType -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ExpenseType
s@ExpenseType' {} Maybe Double
a -> ExpenseType
s {$sel:confidence:ExpenseType' :: Maybe Double
confidence = Maybe Double
a} :: ExpenseType)
instance Core.FromJSON ExpenseType where
parseJSON :: Value -> Parser ExpenseType
parseJSON =
String
-> (Object -> Parser ExpenseType) -> Value -> Parser ExpenseType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ExpenseType"
( \Object
x ->
Maybe Text -> Maybe Double -> ExpenseType
ExpenseType'
(Maybe Text -> Maybe Double -> ExpenseType)
-> Parser (Maybe Text) -> Parser (Maybe Double -> ExpenseType)
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 -> ExpenseType)
-> Parser (Maybe Double) -> Parser ExpenseType
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")
)
instance Prelude.Hashable ExpenseType
instance Prelude.NFData ExpenseType