{-# 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.Rekognition.Types.TextDetection where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.Geometry
import Amazonka.Rekognition.Types.TextTypes
data TextDetection = TextDetection'
{
TextDetection -> Maybe Text
detectedText :: Prelude.Maybe Prelude.Text,
TextDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
TextDetection -> Maybe Geometry
geometry :: Prelude.Maybe Geometry,
TextDetection -> Maybe Natural
id :: Prelude.Maybe Prelude.Natural,
TextDetection -> Maybe TextTypes
type' :: Prelude.Maybe TextTypes,
TextDetection -> Maybe Natural
parentId :: Prelude.Maybe Prelude.Natural
}
deriving (TextDetection -> TextDetection -> Bool
(TextDetection -> TextDetection -> Bool)
-> (TextDetection -> TextDetection -> Bool) -> Eq TextDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDetection -> TextDetection -> Bool
$c/= :: TextDetection -> TextDetection -> Bool
== :: TextDetection -> TextDetection -> Bool
$c== :: TextDetection -> TextDetection -> Bool
Prelude.Eq, ReadPrec [TextDetection]
ReadPrec TextDetection
Int -> ReadS TextDetection
ReadS [TextDetection]
(Int -> ReadS TextDetection)
-> ReadS [TextDetection]
-> ReadPrec TextDetection
-> ReadPrec [TextDetection]
-> Read TextDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextDetection]
$creadListPrec :: ReadPrec [TextDetection]
readPrec :: ReadPrec TextDetection
$creadPrec :: ReadPrec TextDetection
readList :: ReadS [TextDetection]
$creadList :: ReadS [TextDetection]
readsPrec :: Int -> ReadS TextDetection
$creadsPrec :: Int -> ReadS TextDetection
Prelude.Read, Int -> TextDetection -> ShowS
[TextDetection] -> ShowS
TextDetection -> String
(Int -> TextDetection -> ShowS)
-> (TextDetection -> String)
-> ([TextDetection] -> ShowS)
-> Show TextDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDetection] -> ShowS
$cshowList :: [TextDetection] -> ShowS
show :: TextDetection -> String
$cshow :: TextDetection -> String
showsPrec :: Int -> TextDetection -> ShowS
$cshowsPrec :: Int -> TextDetection -> ShowS
Prelude.Show, (forall x. TextDetection -> Rep TextDetection x)
-> (forall x. Rep TextDetection x -> TextDetection)
-> Generic TextDetection
forall x. Rep TextDetection x -> TextDetection
forall x. TextDetection -> Rep TextDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextDetection x -> TextDetection
$cfrom :: forall x. TextDetection -> Rep TextDetection x
Prelude.Generic)
newTextDetection ::
TextDetection
newTextDetection :: TextDetection
newTextDetection =
TextDetection' :: Maybe Text
-> Maybe Double
-> Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection
TextDetection'
{ $sel:detectedText:TextDetection' :: Maybe Text
detectedText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:confidence:TextDetection' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:geometry:TextDetection' :: Maybe Geometry
geometry = Maybe Geometry
forall a. Maybe a
Prelude.Nothing,
$sel:id:TextDetection' :: Maybe Natural
id = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:type':TextDetection' :: Maybe TextTypes
type' = Maybe TextTypes
forall a. Maybe a
Prelude.Nothing,
$sel:parentId:TextDetection' :: Maybe Natural
parentId = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
textDetection_detectedText :: Lens.Lens' TextDetection (Prelude.Maybe Prelude.Text)
textDetection_detectedText :: (Maybe Text -> f (Maybe Text)) -> TextDetection -> f TextDetection
textDetection_detectedText = (TextDetection -> Maybe Text)
-> (TextDetection -> Maybe Text -> TextDetection)
-> Lens TextDetection TextDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe Text
detectedText :: Maybe Text
$sel:detectedText:TextDetection' :: TextDetection -> Maybe Text
detectedText} -> Maybe Text
detectedText) (\s :: TextDetection
s@TextDetection' {} Maybe Text
a -> TextDetection
s {$sel:detectedText:TextDetection' :: Maybe Text
detectedText = Maybe Text
a} :: TextDetection)
textDetection_confidence :: Lens.Lens' TextDetection (Prelude.Maybe Prelude.Double)
textDetection_confidence :: (Maybe Double -> f (Maybe Double))
-> TextDetection -> f TextDetection
textDetection_confidence = (TextDetection -> Maybe Double)
-> (TextDetection -> Maybe Double -> TextDetection)
-> Lens TextDetection TextDetection (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe Double
confidence :: Maybe Double
$sel:confidence:TextDetection' :: TextDetection -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: TextDetection
s@TextDetection' {} Maybe Double
a -> TextDetection
s {$sel:confidence:TextDetection' :: Maybe Double
confidence = Maybe Double
a} :: TextDetection)
textDetection_geometry :: Lens.Lens' TextDetection (Prelude.Maybe Geometry)
textDetection_geometry :: (Maybe Geometry -> f (Maybe Geometry))
-> TextDetection -> f TextDetection
textDetection_geometry = (TextDetection -> Maybe Geometry)
-> (TextDetection -> Maybe Geometry -> TextDetection)
-> Lens
TextDetection TextDetection (Maybe Geometry) (Maybe Geometry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe Geometry
geometry :: Maybe Geometry
$sel:geometry:TextDetection' :: TextDetection -> Maybe Geometry
geometry} -> Maybe Geometry
geometry) (\s :: TextDetection
s@TextDetection' {} Maybe Geometry
a -> TextDetection
s {$sel:geometry:TextDetection' :: Maybe Geometry
geometry = Maybe Geometry
a} :: TextDetection)
textDetection_id :: Lens.Lens' TextDetection (Prelude.Maybe Prelude.Natural)
textDetection_id :: (Maybe Natural -> f (Maybe Natural))
-> TextDetection -> f TextDetection
textDetection_id = (TextDetection -> Maybe Natural)
-> (TextDetection -> Maybe Natural -> TextDetection)
-> Lens TextDetection TextDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe Natural
id :: Maybe Natural
$sel:id:TextDetection' :: TextDetection -> Maybe Natural
id} -> Maybe Natural
id) (\s :: TextDetection
s@TextDetection' {} Maybe Natural
a -> TextDetection
s {$sel:id:TextDetection' :: Maybe Natural
id = Maybe Natural
a} :: TextDetection)
textDetection_type :: Lens.Lens' TextDetection (Prelude.Maybe TextTypes)
textDetection_type :: (Maybe TextTypes -> f (Maybe TextTypes))
-> TextDetection -> f TextDetection
textDetection_type = (TextDetection -> Maybe TextTypes)
-> (TextDetection -> Maybe TextTypes -> TextDetection)
-> Lens
TextDetection TextDetection (Maybe TextTypes) (Maybe TextTypes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe TextTypes
type' :: Maybe TextTypes
$sel:type':TextDetection' :: TextDetection -> Maybe TextTypes
type'} -> Maybe TextTypes
type') (\s :: TextDetection
s@TextDetection' {} Maybe TextTypes
a -> TextDetection
s {$sel:type':TextDetection' :: Maybe TextTypes
type' = Maybe TextTypes
a} :: TextDetection)
textDetection_parentId :: Lens.Lens' TextDetection (Prelude.Maybe Prelude.Natural)
textDetection_parentId :: (Maybe Natural -> f (Maybe Natural))
-> TextDetection -> f TextDetection
textDetection_parentId = (TextDetection -> Maybe Natural)
-> (TextDetection -> Maybe Natural -> TextDetection)
-> Lens TextDetection TextDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetection' {Maybe Natural
parentId :: Maybe Natural
$sel:parentId:TextDetection' :: TextDetection -> Maybe Natural
parentId} -> Maybe Natural
parentId) (\s :: TextDetection
s@TextDetection' {} Maybe Natural
a -> TextDetection
s {$sel:parentId:TextDetection' :: Maybe Natural
parentId = Maybe Natural
a} :: TextDetection)
instance Core.FromJSON TextDetection where
parseJSON :: Value -> Parser TextDetection
parseJSON =
String
-> (Object -> Parser TextDetection)
-> Value
-> Parser TextDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TextDetection"
( \Object
x ->
Maybe Text
-> Maybe Double
-> Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection
TextDetection'
(Maybe Text
-> Maybe Double
-> Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection)
-> Parser (Maybe Text)
-> Parser
(Maybe Double
-> Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection)
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
"DetectedText")
Parser
(Maybe Double
-> Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection)
-> Parser (Maybe Double)
-> Parser
(Maybe Geometry
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection)
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
-> Maybe Natural
-> Maybe TextTypes
-> Maybe Natural
-> TextDetection)
-> Parser (Maybe Geometry)
-> Parser
(Maybe Natural
-> Maybe TextTypes -> Maybe Natural -> TextDetection)
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")
Parser
(Maybe Natural
-> Maybe TextTypes -> Maybe Natural -> TextDetection)
-> Parser (Maybe Natural)
-> Parser (Maybe TextTypes -> Maybe Natural -> TextDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
Parser (Maybe TextTypes -> Maybe Natural -> TextDetection)
-> Parser (Maybe TextTypes)
-> Parser (Maybe Natural -> TextDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TextTypes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Maybe Natural -> TextDetection)
-> Parser (Maybe Natural) -> Parser TextDetection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ParentId")
)
instance Prelude.Hashable TextDetection
instance Prelude.NFData TextDetection