{-# 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.PolygonGeometryInput
-- 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.PolygonGeometryInput 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:/ 'newPolygonGeometryInput' smart constructor.
data PolygonGeometryInput = PolygonGeometryInput'
  { PolygonGeometryInput
-> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates :: Prelude.NonEmpty (Prelude.NonEmpty (Data.Sensitive (Prelude.NonEmpty Prelude.Double)))
  }
  deriving (PolygonGeometryInput -> PolygonGeometryInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolygonGeometryInput -> PolygonGeometryInput -> Bool
$c/= :: PolygonGeometryInput -> PolygonGeometryInput -> Bool
== :: PolygonGeometryInput -> PolygonGeometryInput -> Bool
$c== :: PolygonGeometryInput -> PolygonGeometryInput -> Bool
Prelude.Eq, Int -> PolygonGeometryInput -> ShowS
[PolygonGeometryInput] -> ShowS
PolygonGeometryInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolygonGeometryInput] -> ShowS
$cshowList :: [PolygonGeometryInput] -> ShowS
show :: PolygonGeometryInput -> String
$cshow :: PolygonGeometryInput -> String
showsPrec :: Int -> PolygonGeometryInput -> ShowS
$cshowsPrec :: Int -> PolygonGeometryInput -> ShowS
Prelude.Show, forall x. Rep PolygonGeometryInput x -> PolygonGeometryInput
forall x. PolygonGeometryInput -> Rep PolygonGeometryInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolygonGeometryInput x -> PolygonGeometryInput
$cfrom :: forall x. PolygonGeometryInput -> Rep PolygonGeometryInput x
Prelude.Generic)

-- |
-- Create a value of 'PolygonGeometryInput' 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', 'polygonGeometryInput_coordinates' -
newPolygonGeometryInput ::
  -- | 'coordinates'
  Prelude.NonEmpty (Prelude.NonEmpty (Prelude.NonEmpty Prelude.Double)) ->
  PolygonGeometryInput
newPolygonGeometryInput :: NonEmpty (NonEmpty (NonEmpty Double)) -> PolygonGeometryInput
newPolygonGeometryInput NonEmpty (NonEmpty (NonEmpty Double))
pCoordinates_ =
  PolygonGeometryInput'
    { $sel:coordinates:PolygonGeometryInput' :: 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_
    }

polygonGeometryInput_coordinates :: Lens.Lens' PolygonGeometryInput (Prelude.NonEmpty (Prelude.NonEmpty (Prelude.NonEmpty Prelude.Double)))
polygonGeometryInput_coordinates :: Lens' PolygonGeometryInput (NonEmpty (NonEmpty (NonEmpty Double)))
polygonGeometryInput_coordinates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolygonGeometryInput' {NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
$sel:coordinates:PolygonGeometryInput' :: PolygonGeometryInput
-> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates} -> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates) (\s :: PolygonGeometryInput
s@PolygonGeometryInput' {} NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
a -> PolygonGeometryInput
s {$sel:coordinates:PolygonGeometryInput' :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates = NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
a} :: PolygonGeometryInput) 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 PolygonGeometryInput where
  parseJSON :: Value -> Parser PolygonGeometryInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PolygonGeometryInput"
      ( \Object
x ->
          NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
-> PolygonGeometryInput
PolygonGeometryInput'
            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")
      )

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

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

instance Data.ToJSON PolygonGeometryInput where
  toJSON :: PolygonGeometryInput -> Value
toJSON PolygonGeometryInput' {NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates :: NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
$sel:coordinates:PolygonGeometryInput' :: PolygonGeometryInput
-> NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Coordinates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty (NonEmpty (Sensitive (NonEmpty Double)))
coordinates)]
      )