{-# 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.Geometry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Textract.Types.BoundingBox
import Amazonka.Textract.Types.Point
data Geometry = Geometry'
{
Geometry -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
Geometry -> Maybe [Point]
polygon :: Prelude.Maybe [Point]
}
deriving (Geometry -> Geometry -> Bool
(Geometry -> Geometry -> Bool)
-> (Geometry -> Geometry -> Bool) -> Eq Geometry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Geometry -> Geometry -> Bool
$c/= :: Geometry -> Geometry -> Bool
== :: Geometry -> Geometry -> Bool
$c== :: Geometry -> Geometry -> Bool
Prelude.Eq, ReadPrec [Geometry]
ReadPrec Geometry
Int -> ReadS Geometry
ReadS [Geometry]
(Int -> ReadS Geometry)
-> ReadS [Geometry]
-> ReadPrec Geometry
-> ReadPrec [Geometry]
-> Read Geometry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Geometry]
$creadListPrec :: ReadPrec [Geometry]
readPrec :: ReadPrec Geometry
$creadPrec :: ReadPrec Geometry
readList :: ReadS [Geometry]
$creadList :: ReadS [Geometry]
readsPrec :: Int -> ReadS Geometry
$creadsPrec :: Int -> ReadS Geometry
Prelude.Read, Int -> Geometry -> ShowS
[Geometry] -> ShowS
Geometry -> String
(Int -> Geometry -> ShowS)
-> (Geometry -> String) -> ([Geometry] -> ShowS) -> Show Geometry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Geometry] -> ShowS
$cshowList :: [Geometry] -> ShowS
show :: Geometry -> String
$cshow :: Geometry -> String
showsPrec :: Int -> Geometry -> ShowS
$cshowsPrec :: Int -> Geometry -> ShowS
Prelude.Show, (forall x. Geometry -> Rep Geometry x)
-> (forall x. Rep Geometry x -> Geometry) -> Generic Geometry
forall x. Rep Geometry x -> Geometry
forall x. Geometry -> Rep Geometry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Geometry x -> Geometry
$cfrom :: forall x. Geometry -> Rep Geometry x
Prelude.Generic)
newGeometry ::
Geometry
newGeometry :: Geometry
newGeometry =
Geometry' :: Maybe BoundingBox -> Maybe [Point] -> Geometry
Geometry'
{ $sel:boundingBox:Geometry' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
$sel:polygon:Geometry' :: Maybe [Point]
polygon = Maybe [Point]
forall a. Maybe a
Prelude.Nothing
}
geometry_boundingBox :: Lens.Lens' Geometry (Prelude.Maybe BoundingBox)
geometry_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> Geometry -> f Geometry
geometry_boundingBox = (Geometry -> Maybe BoundingBox)
-> (Geometry -> Maybe BoundingBox -> Geometry)
-> Lens Geometry Geometry (Maybe BoundingBox) (Maybe BoundingBox)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Geometry' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:Geometry' :: Geometry -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: Geometry
s@Geometry' {} Maybe BoundingBox
a -> Geometry
s {$sel:boundingBox:Geometry' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: Geometry)
geometry_polygon :: Lens.Lens' Geometry (Prelude.Maybe [Point])
geometry_polygon :: (Maybe [Point] -> f (Maybe [Point])) -> Geometry -> f Geometry
geometry_polygon = (Geometry -> Maybe [Point])
-> (Geometry -> Maybe [Point] -> Geometry)
-> Lens Geometry Geometry (Maybe [Point]) (Maybe [Point])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Geometry' {Maybe [Point]
polygon :: Maybe [Point]
$sel:polygon:Geometry' :: Geometry -> Maybe [Point]
polygon} -> Maybe [Point]
polygon) (\s :: Geometry
s@Geometry' {} Maybe [Point]
a -> Geometry
s {$sel:polygon:Geometry' :: Maybe [Point]
polygon = Maybe [Point]
a} :: Geometry) ((Maybe [Point] -> f (Maybe [Point])) -> Geometry -> f Geometry)
-> ((Maybe [Point] -> f (Maybe [Point]))
-> Maybe [Point] -> f (Maybe [Point]))
-> (Maybe [Point] -> f (Maybe [Point]))
-> Geometry
-> f Geometry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Point] [Point] [Point] [Point]
-> Iso
(Maybe [Point]) (Maybe [Point]) (Maybe [Point]) (Maybe [Point])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Point] [Point] [Point] [Point]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Geometry where
parseJSON :: Value -> Parser Geometry
parseJSON =
String -> (Object -> Parser Geometry) -> Value -> Parser Geometry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Geometry"
( \Object
x ->
Maybe BoundingBox -> Maybe [Point] -> Geometry
Geometry'
(Maybe BoundingBox -> Maybe [Point] -> Geometry)
-> Parser (Maybe BoundingBox) -> Parser (Maybe [Point] -> Geometry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BoundingBox)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BoundingBox")
Parser (Maybe [Point] -> Geometry)
-> Parser (Maybe [Point]) -> Parser Geometry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Point]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Polygon" Parser (Maybe (Maybe [Point]))
-> Maybe [Point] -> Parser (Maybe [Point])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Point]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Geometry
instance Prelude.NFData Geometry