{-# 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.Location.Types.GeofenceGeometry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types.Circle
import qualified Amazonka.Prelude as Prelude
data GeofenceGeometry = GeofenceGeometry'
{
GeofenceGeometry -> Maybe (Sensitive Circle)
circle :: Prelude.Maybe (Data.Sensitive Circle),
GeofenceGeometry
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon :: Prelude.Maybe (Prelude.NonEmpty (Prelude.NonEmpty (Data.Sensitive (Prelude.NonEmpty Prelude.Double))))
}
deriving (GeofenceGeometry -> GeofenceGeometry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeofenceGeometry -> GeofenceGeometry -> Bool
$c/= :: GeofenceGeometry -> GeofenceGeometry -> Bool
== :: GeofenceGeometry -> GeofenceGeometry -> Bool
$c== :: GeofenceGeometry -> GeofenceGeometry -> Bool
Prelude.Eq, Int -> GeofenceGeometry -> ShowS
[GeofenceGeometry] -> ShowS
GeofenceGeometry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeofenceGeometry] -> ShowS
$cshowList :: [GeofenceGeometry] -> ShowS
show :: GeofenceGeometry -> String
$cshow :: GeofenceGeometry -> String
showsPrec :: Int -> GeofenceGeometry -> ShowS
$cshowsPrec :: Int -> GeofenceGeometry -> ShowS
Prelude.Show, forall x. Rep GeofenceGeometry x -> GeofenceGeometry
forall x. GeofenceGeometry -> Rep GeofenceGeometry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeofenceGeometry x -> GeofenceGeometry
$cfrom :: forall x. GeofenceGeometry -> Rep GeofenceGeometry x
Prelude.Generic)
newGeofenceGeometry ::
GeofenceGeometry
newGeofenceGeometry :: GeofenceGeometry
newGeofenceGeometry =
GeofenceGeometry'
{ $sel:circle:GeofenceGeometry' :: Maybe (Sensitive Circle)
circle = forall a. Maybe a
Prelude.Nothing,
$sel:polygon:GeofenceGeometry' :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon = forall a. Maybe a
Prelude.Nothing
}
geofenceGeometry_circle :: Lens.Lens' GeofenceGeometry (Prelude.Maybe Circle)
geofenceGeometry_circle :: Lens' GeofenceGeometry (Maybe Circle)
geofenceGeometry_circle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeofenceGeometry' {Maybe (Sensitive Circle)
circle :: Maybe (Sensitive Circle)
$sel:circle:GeofenceGeometry' :: GeofenceGeometry -> Maybe (Sensitive Circle)
circle} -> Maybe (Sensitive Circle)
circle) (\s :: GeofenceGeometry
s@GeofenceGeometry' {} Maybe (Sensitive Circle)
a -> GeofenceGeometry
s {$sel:circle:GeofenceGeometry' :: Maybe (Sensitive Circle)
circle = Maybe (Sensitive Circle)
a} :: GeofenceGeometry) 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 a. Iso' (Sensitive a) a
Data._Sensitive
geofenceGeometry_polygon :: Lens.Lens' GeofenceGeometry (Prelude.Maybe (Prelude.NonEmpty (Prelude.NonEmpty (Prelude.NonEmpty Prelude.Double))))
geofenceGeometry_polygon :: Lens'
GeofenceGeometry (Maybe (NonEmpty (NonEmpty (NonEmpty Double))))
geofenceGeometry_polygon = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeofenceGeometry' {Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
$sel:polygon:GeofenceGeometry' :: GeofenceGeometry
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon} -> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon) (\s :: GeofenceGeometry
s@GeofenceGeometry' {} Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
a -> GeofenceGeometry
s {$sel:polygon:GeofenceGeometry' :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon = Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
a} :: GeofenceGeometry) 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 GeofenceGeometry where
parseJSON :: Value -> Parser GeofenceGeometry
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GeofenceGeometry"
( \Object
x ->
Maybe (Sensitive Circle)
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
-> GeofenceGeometry
GeofenceGeometry'
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
"Circle")
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")
)
instance Prelude.Hashable GeofenceGeometry where
hashWithSalt :: Int -> GeofenceGeometry -> Int
hashWithSalt Int
_salt GeofenceGeometry' {Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
Maybe (Sensitive Circle)
polygon :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
circle :: Maybe (Sensitive Circle)
$sel:polygon:GeofenceGeometry' :: GeofenceGeometry
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
$sel:circle:GeofenceGeometry' :: GeofenceGeometry -> Maybe (Sensitive Circle)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Circle)
circle
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon
instance Prelude.NFData GeofenceGeometry where
rnf :: GeofenceGeometry -> ()
rnf GeofenceGeometry' {Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
Maybe (Sensitive Circle)
polygon :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
circle :: Maybe (Sensitive Circle)
$sel:polygon:GeofenceGeometry' :: GeofenceGeometry
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
$sel:circle:GeofenceGeometry' :: GeofenceGeometry -> Maybe (Sensitive Circle)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Circle)
circle
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon
instance Data.ToJSON GeofenceGeometry where
toJSON :: GeofenceGeometry -> Value
toJSON GeofenceGeometry' {Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
Maybe (Sensitive Circle)
polygon :: Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
circle :: Maybe (Sensitive Circle)
$sel:polygon:GeofenceGeometry' :: GeofenceGeometry
-> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
$sel:circle:GeofenceGeometry' :: GeofenceGeometry -> Maybe (Sensitive Circle)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Circle" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Circle)
circle,
(Key
"Polygon" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty (NonEmpty (Sensitive (NonEmpty Double))))
polygon
]
)