{-# 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.SageMakerGeoSpatial.Types.Geometry
-- 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.SageMakerGeoSpatial.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

-- |
--
-- /See:/ 'newGeometry' smart constructor.
data Geometry = Geometry'
  { Geometry -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates :: Prelude.NonEmpty (Prelude.NonEmpty (Data.Sensitive (Prelude.NonEmpty Prelude.Double))),
    Geometry -> Text
type' :: Prelude.Text
  }
  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, 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)

-- |
-- Create a value of 'Geometry' 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:
--
-- 'coordinates', 'geometry_coordinates' -
--
-- 'type'', 'geometry_type' -
newGeometry ::
  -- | 'coordinates'
  Prelude.NonEmpty (Prelude.NonEmpty (Prelude.NonEmpty Prelude.Double)) ->
  -- | 'type''
  Prelude.Text ->
  Geometry
newGeometry :: NonEmpty (NonEmpty (NonEmpty Double)) -> Text -> Geometry
newGeometry NonEmpty (NonEmpty (NonEmpty Double))
pCoordinates_ Text
pType_ =
  Geometry'
    { $sel:coordinates:Geometry' :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates =
        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 (NonEmpty (NonEmpty Double))
pCoordinates_,
      $sel:type':Geometry' :: Text
type' = Text
pType_
    }

geometry_coordinates :: Lens.Lens' Geometry (Prelude.NonEmpty (Prelude.NonEmpty (Prelude.NonEmpty Prelude.Double)))
geometry_coordinates :: Lens' Geometry (NonEmpty (NonEmpty (NonEmpty Double)))
geometry_coordinates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Geometry' {NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
$sel:coordinates:Geometry' :: Geometry -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates} -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates) (\s :: Geometry
s@Geometry' {} NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
a -> Geometry
s {$sel:coordinates:Geometry' :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates = NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
a} :: Geometry) 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

geometry_type :: Lens.Lens' Geometry Prelude.Text
geometry_type :: Lens' Geometry Text
geometry_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Geometry' {Text
type' :: Text
$sel:type':Geometry' :: Geometry -> Text
type'} -> Text
type') (\s :: Geometry
s@Geometry' {} Text
a -> Geometry
s {$sel:type':Geometry' :: Text
type' = Text
a} :: Geometry)

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 ->
          NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
-> Text -> Geometry
Geometry'
            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
"Coordinates")
            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
"Type")
      )

instance Prelude.Hashable Geometry where
  hashWithSalt :: Int -> Geometry -> Int
hashWithSalt Int
_salt Geometry' {NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
Text
type' :: Text
coordinates :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
$sel:type':Geometry' :: Geometry -> Text
$sel:coordinates:Geometry' :: Geometry -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'

instance Prelude.NFData Geometry where
  rnf :: Geometry -> ()
rnf Geometry' {NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
Text
type' :: Text
coordinates :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
$sel:type':Geometry' :: Geometry -> Text
$sel:coordinates:Geometry' :: Geometry -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'