{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Location.Types.PlaceGeometry 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

-- | 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 (Data.Sensitive (Prelude.NonEmpty Prelude.Double))
  }
  deriving (PlaceGeometry -> PlaceGeometry -> Bool
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
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. 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' {$sel:point:PlaceGeometry' :: Maybe (Sensitive (NonEmpty Double))
point = 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 :: Lens' PlaceGeometry (Maybe (NonEmpty Double))
placeGeometry_point = 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) 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 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)

instance Data.FromJSON PlaceGeometry where
  parseJSON :: Value -> Parser PlaceGeometry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PlaceGeometry"
      ( \Object
x ->
          Maybe (Sensitive (NonEmpty Double)) -> PlaceGeometry
PlaceGeometry' 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
"Point")
      )

instance Prelude.Hashable PlaceGeometry where
  hashWithSalt :: Int -> PlaceGeometry -> Int
hashWithSalt Int
_salt PlaceGeometry' {Maybe (Sensitive (NonEmpty Double))
point :: Maybe (Sensitive (NonEmpty Double))
$sel:point:PlaceGeometry' :: PlaceGeometry -> Maybe (Sensitive (NonEmpty Double))
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (NonEmpty Double))
point

instance Prelude.NFData PlaceGeometry where
  rnf :: PlaceGeometry -> ()
rnf PlaceGeometry' {Maybe (Sensitive (NonEmpty Double))
point :: Maybe (Sensitive (NonEmpty Double))
$sel:point:PlaceGeometry' :: PlaceGeometry -> Maybe (Sensitive (NonEmpty Double))
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (NonEmpty Double))
point