{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Location.Types.PlaceGeometry
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Location.Types.PlaceGeometry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Places uses a point geometry to specify a location or a Place.
--
-- /See:/ 'newPlaceGeometry' smart constructor.
data PlaceGeometry = PlaceGeometry'
  { -- | A single point geometry specifies a location for a Place using
    -- <https://gisgeography.com/wgs84-world-geodetic-system/ WGS 84>
    -- coordinates:
    --
    -- -   /x/ — Specifies the x coordinate or longitude.
    --
    -- -   /y/ — Specifies the y coordinate or latitude.
    PlaceGeometry -> Maybe (Sensitive (NonEmpty Double))
point :: Prelude.Maybe (Core.Sensitive (Prelude.NonEmpty Prelude.Double))
  }
  deriving (PlaceGeometry -> PlaceGeometry -> Bool
(PlaceGeometry -> PlaceGeometry -> Bool)
-> (PlaceGeometry -> PlaceGeometry -> Bool) -> Eq PlaceGeometry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlaceGeometry -> PlaceGeometry -> Bool
$c/= :: PlaceGeometry -> PlaceGeometry -> Bool
== :: PlaceGeometry -> PlaceGeometry -> Bool
$c== :: PlaceGeometry -> PlaceGeometry -> Bool
Prelude.Eq, Int -> PlaceGeometry -> ShowS
[PlaceGeometry] -> ShowS
PlaceGeometry -> String
(Int -> PlaceGeometry -> ShowS)
-> (PlaceGeometry -> String)
-> ([PlaceGeometry] -> ShowS)
-> Show PlaceGeometry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlaceGeometry] -> ShowS
$cshowList :: [PlaceGeometry] -> ShowS
show :: PlaceGeometry -> String
$cshow :: PlaceGeometry -> String
showsPrec :: Int -> PlaceGeometry -> ShowS
$cshowsPrec :: Int -> PlaceGeometry -> ShowS
Prelude.Show, (forall x. PlaceGeometry -> Rep PlaceGeometry x)
-> (forall x. Rep PlaceGeometry x -> PlaceGeometry)
-> Generic PlaceGeometry
forall x. Rep PlaceGeometry x -> PlaceGeometry
forall x. PlaceGeometry -> Rep PlaceGeometry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlaceGeometry x -> PlaceGeometry
$cfrom :: forall x. PlaceGeometry -> Rep PlaceGeometry x
Prelude.Generic)

-- |
-- Create a value of 'PlaceGeometry' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'point', 'placeGeometry_point' - A single point geometry specifies a location for a Place using
-- <https://gisgeography.com/wgs84-world-geodetic-system/ WGS 84>
-- coordinates:
--
-- -   /x/ — Specifies the x coordinate or longitude.
--
-- -   /y/ — Specifies the y coordinate or latitude.
newPlaceGeometry ::
  PlaceGeometry
newPlaceGeometry :: PlaceGeometry
newPlaceGeometry =
  PlaceGeometry' :: Maybe (Sensitive (NonEmpty Double)) -> PlaceGeometry
PlaceGeometry' {$sel:point:PlaceGeometry' :: Maybe (Sensitive (NonEmpty Double))
point = Maybe (Sensitive (NonEmpty Double))
forall a. Maybe a
Prelude.Nothing}

-- | A single point geometry specifies a location for a Place using
-- <https://gisgeography.com/wgs84-world-geodetic-system/ WGS 84>
-- coordinates:
--
-- -   /x/ — Specifies the x coordinate or longitude.
--
-- -   /y/ — Specifies the y coordinate or latitude.
placeGeometry_point :: Lens.Lens' PlaceGeometry (Prelude.Maybe (Prelude.NonEmpty Prelude.Double))
placeGeometry_point :: (Maybe (NonEmpty Double) -> f (Maybe (NonEmpty Double)))
-> PlaceGeometry -> f PlaceGeometry
placeGeometry_point = (PlaceGeometry -> Maybe (Sensitive (NonEmpty Double)))
-> (PlaceGeometry
    -> Maybe (Sensitive (NonEmpty Double)) -> PlaceGeometry)
-> Lens
     PlaceGeometry
     PlaceGeometry
     (Maybe (Sensitive (NonEmpty Double)))
     (Maybe (Sensitive (NonEmpty Double)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlaceGeometry' {Maybe (Sensitive (NonEmpty Double))
point :: Maybe (Sensitive (NonEmpty Double))
$sel:point:PlaceGeometry' :: PlaceGeometry -> Maybe (Sensitive (NonEmpty Double))
point} -> Maybe (Sensitive (NonEmpty Double))
point) (\s :: PlaceGeometry
s@PlaceGeometry' {} Maybe (Sensitive (NonEmpty Double))
a -> PlaceGeometry
s {$sel:point:PlaceGeometry' :: Maybe (Sensitive (NonEmpty Double))
point = Maybe (Sensitive (NonEmpty Double))
a} :: PlaceGeometry) ((Maybe (Sensitive (NonEmpty Double))
  -> f (Maybe (Sensitive (NonEmpty Double))))
 -> PlaceGeometry -> f PlaceGeometry)
-> ((Maybe (NonEmpty Double) -> f (Maybe (NonEmpty Double)))
    -> Maybe (Sensitive (NonEmpty Double))
    -> f (Maybe (Sensitive (NonEmpty Double))))
-> (Maybe (NonEmpty Double) -> f (Maybe (NonEmpty Double)))
-> PlaceGeometry
-> f PlaceGeometry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (Sensitive (NonEmpty Double))
  (Sensitive (NonEmpty Double))
  (NonEmpty Double)
  (NonEmpty Double)
-> Iso
     (Maybe (Sensitive (NonEmpty Double)))
     (Maybe (Sensitive (NonEmpty Double)))
     (Maybe (NonEmpty Double))
     (Maybe (NonEmpty Double))
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
  (Sensitive (NonEmpty Double))
  (Sensitive (NonEmpty Double))
  (NonEmpty Double)
  (NonEmpty Double)
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso
  (Sensitive (NonEmpty Double))
  (Sensitive (NonEmpty Double))
  (NonEmpty Double)
  (NonEmpty Double)
-> (Exchange
      (NonEmpty Double)
      (NonEmpty Double)
      (NonEmpty Double)
      (Identity (NonEmpty Double))
    -> Exchange
         (NonEmpty Double)
         (NonEmpty Double)
         (NonEmpty Double)
         (Identity (NonEmpty Double)))
-> AnIso
     (Sensitive (NonEmpty Double))
     (Sensitive (NonEmpty Double))
     (NonEmpty Double)
     (NonEmpty Double)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
  (NonEmpty Double)
  (NonEmpty Double)
  (NonEmpty Double)
  (Identity (NonEmpty Double))
-> Exchange
     (NonEmpty Double)
     (NonEmpty Double)
     (NonEmpty Double)
     (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

instance Core.FromJSON PlaceGeometry where
  parseJSON :: Value -> Parser PlaceGeometry
parseJSON =
    String
-> (Object -> Parser PlaceGeometry)
-> Value
-> Parser PlaceGeometry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlaceGeometry"
      ( \Object
x ->
          Maybe (Sensitive (NonEmpty Double)) -> PlaceGeometry
PlaceGeometry' (Maybe (Sensitive (NonEmpty Double)) -> PlaceGeometry)
-> Parser (Maybe (Sensitive (NonEmpty Double)))
-> Parser PlaceGeometry
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive (NonEmpty Double)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Point")
      )

instance Prelude.Hashable PlaceGeometry

instance Prelude.NFData PlaceGeometry