{-# 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.Geometry 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.Rekognition.Types.BoundingBox
import Amazonka.Rekognition.Types.Point
data Geometry = Geometry'
{
Geometry -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
Geometry -> Maybe [Point]
polygon :: Prelude.Maybe [Point]
}
deriving (Geometry -> Geometry -> Bool
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]
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
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. 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'
{ $sel:boundingBox:Geometry' :: Maybe BoundingBox
boundingBox = forall a. Maybe a
Prelude.Nothing,
$sel:polygon:Geometry' :: Maybe [Point]
polygon = forall a. Maybe a
Prelude.Nothing
}
geometry_boundingBox :: Lens.Lens' Geometry (Prelude.Maybe BoundingBox)
geometry_boundingBox :: Lens' Geometry (Maybe BoundingBox)
geometry_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 :: Lens' Geometry (Maybe [Point])
geometry_polygon = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Geometry where
parseJSON :: Value -> Parser Geometry
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Geometry"
( \Object
x ->
Maybe BoundingBox -> Maybe [Point] -> Geometry
Geometry'
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
"BoundingBox")
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
"Polygon" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Geometry where
hashWithSalt :: Int -> Geometry -> Int
hashWithSalt Int
_salt Geometry' {Maybe [Point]
Maybe BoundingBox
polygon :: Maybe [Point]
boundingBox :: Maybe BoundingBox
$sel:polygon:Geometry' :: Geometry -> Maybe [Point]
$sel:boundingBox:Geometry' :: Geometry -> Maybe BoundingBox
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BoundingBox
boundingBox
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Point]
polygon
instance Prelude.NFData Geometry where
rnf :: Geometry -> ()
rnf Geometry' {Maybe [Point]
Maybe BoundingBox
polygon :: Maybe [Point]
boundingBox :: Maybe BoundingBox
$sel:polygon:Geometry' :: Geometry -> Maybe [Point]
$sel:boundingBox:Geometry' :: Geometry -> Maybe BoundingBox
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BoundingBox
boundingBox
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Point]
polygon