{-# 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.Circle 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
data Circle = Circle'
{
Circle -> Sensitive (NonEmpty Double)
center :: Data.Sensitive (Prelude.NonEmpty Prelude.Double),
Circle -> Double
radius :: Prelude.Double
}
deriving (Circle -> Circle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Circle -> Circle -> Bool
$c/= :: Circle -> Circle -> Bool
== :: Circle -> Circle -> Bool
$c== :: Circle -> Circle -> Bool
Prelude.Eq, Int -> Circle -> ShowS
[Circle] -> ShowS
Circle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Circle] -> ShowS
$cshowList :: [Circle] -> ShowS
show :: Circle -> String
$cshow :: Circle -> String
showsPrec :: Int -> Circle -> ShowS
$cshowsPrec :: Int -> Circle -> ShowS
Prelude.Show, forall x. Rep Circle x -> Circle
forall x. Circle -> Rep Circle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Circle x -> Circle
$cfrom :: forall x. Circle -> Rep Circle x
Prelude.Generic)
newCircle ::
Prelude.NonEmpty Prelude.Double ->
Prelude.Double ->
Circle
newCircle :: NonEmpty Double -> Double -> Circle
newCircle NonEmpty Double
pCenter_ Double
pRadius_ =
Circle'
{ $sel:center:Circle' :: Sensitive (NonEmpty Double)
center =
forall a. Iso' (Sensitive a) a
Data._Sensitive
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pCenter_,
$sel:radius:Circle' :: Double
radius = Double
pRadius_
}
circle_center :: Lens.Lens' Circle (Prelude.NonEmpty Prelude.Double)
circle_center :: Lens' Circle (NonEmpty Double)
circle_center = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Circle' {Sensitive (NonEmpty Double)
center :: Sensitive (NonEmpty Double)
$sel:center:Circle' :: Circle -> Sensitive (NonEmpty Double)
center} -> Sensitive (NonEmpty Double)
center) (\s :: Circle
s@Circle' {} Sensitive (NonEmpty Double)
a -> Circle
s {$sel:center:Circle' :: Sensitive (NonEmpty Double)
center = Sensitive (NonEmpty Double)
a} :: Circle) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
circle_radius :: Lens.Lens' Circle Prelude.Double
circle_radius :: Lens' Circle Double
circle_radius = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Circle' {Double
radius :: Double
$sel:radius:Circle' :: Circle -> Double
radius} -> Double
radius) (\s :: Circle
s@Circle' {} Double
a -> Circle
s {$sel:radius:Circle' :: Double
radius = Double
a} :: Circle)
instance Data.FromJSON Circle where
parseJSON :: Value -> Parser Circle
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Circle"
( \Object
x ->
Sensitive (NonEmpty Double) -> Double -> Circle
Circle'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Center")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Radius")
)
instance Prelude.Hashable Circle where
hashWithSalt :: Int -> Circle -> Int
hashWithSalt Int
_salt Circle' {Double
Sensitive (NonEmpty Double)
radius :: Double
center :: Sensitive (NonEmpty Double)
$sel:radius:Circle' :: Circle -> Double
$sel:center:Circle' :: Circle -> Sensitive (NonEmpty Double)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
center
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
radius
instance Prelude.NFData Circle where
rnf :: Circle -> ()
rnf Circle' {Double
Sensitive (NonEmpty Double)
radius :: Double
center :: Sensitive (NonEmpty Double)
$sel:radius:Circle' :: Circle -> Double
$sel:center:Circle' :: Circle -> Sensitive (NonEmpty Double)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty Double)
center seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
radius
instance Data.ToJSON Circle where
toJSON :: Circle -> Value
toJSON Circle' {Double
Sensitive (NonEmpty Double)
radius :: Double
center :: Sensitive (NonEmpty Double)
$sel:radius:Circle' :: Circle -> Double
$sel:center:Circle' :: Circle -> Sensitive (NonEmpty Double)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Center" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive (NonEmpty Double)
center),
forall a. a -> Maybe a
Prelude.Just (Key
"Radius" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
radius)
]
)