{-# 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.BatchPutGeofenceRequestEntry
-- 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.BatchPutGeofenceRequestEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types.GeofenceGeometry
import qualified Amazonka.Prelude as Prelude

-- | Contains geofence geometry details.
--
-- /See:/ 'newBatchPutGeofenceRequestEntry' smart constructor.
data BatchPutGeofenceRequestEntry = BatchPutGeofenceRequestEntry'
  { -- | The identifier for the geofence to be stored in a given geofence
    -- collection.
    BatchPutGeofenceRequestEntry -> Text
geofenceId :: Prelude.Text,
    -- | Contains the details of the position of the geofence. Can be either a
    -- polygon or a circle. Including both will return a validation error.
    --
    -- Each
    -- <https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html geofence polygon>
    -- can have a maximum of 1,000 vertices.
    BatchPutGeofenceRequestEntry -> GeofenceGeometry
geometry :: GeofenceGeometry
  }
  deriving (BatchPutGeofenceRequestEntry
-> BatchPutGeofenceRequestEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutGeofenceRequestEntry
-> BatchPutGeofenceRequestEntry -> Bool
$c/= :: BatchPutGeofenceRequestEntry
-> BatchPutGeofenceRequestEntry -> Bool
== :: BatchPutGeofenceRequestEntry
-> BatchPutGeofenceRequestEntry -> Bool
$c== :: BatchPutGeofenceRequestEntry
-> BatchPutGeofenceRequestEntry -> Bool
Prelude.Eq, Int -> BatchPutGeofenceRequestEntry -> ShowS
[BatchPutGeofenceRequestEntry] -> ShowS
BatchPutGeofenceRequestEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutGeofenceRequestEntry] -> ShowS
$cshowList :: [BatchPutGeofenceRequestEntry] -> ShowS
show :: BatchPutGeofenceRequestEntry -> String
$cshow :: BatchPutGeofenceRequestEntry -> String
showsPrec :: Int -> BatchPutGeofenceRequestEntry -> ShowS
$cshowsPrec :: Int -> BatchPutGeofenceRequestEntry -> ShowS
Prelude.Show, forall x.
Rep BatchPutGeofenceRequestEntry x -> BatchPutGeofenceRequestEntry
forall x.
BatchPutGeofenceRequestEntry -> Rep BatchPutGeofenceRequestEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPutGeofenceRequestEntry x -> BatchPutGeofenceRequestEntry
$cfrom :: forall x.
BatchPutGeofenceRequestEntry -> Rep BatchPutGeofenceRequestEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutGeofenceRequestEntry' 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:
--
-- 'geofenceId', 'batchPutGeofenceRequestEntry_geofenceId' - The identifier for the geofence to be stored in a given geofence
-- collection.
--
-- 'geometry', 'batchPutGeofenceRequestEntry_geometry' - Contains the details of the position of the geofence. Can be either a
-- polygon or a circle. Including both will return a validation error.
--
-- Each
-- <https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html geofence polygon>
-- can have a maximum of 1,000 vertices.
newBatchPutGeofenceRequestEntry ::
  -- | 'geofenceId'
  Prelude.Text ->
  -- | 'geometry'
  GeofenceGeometry ->
  BatchPutGeofenceRequestEntry
newBatchPutGeofenceRequestEntry :: Text -> GeofenceGeometry -> BatchPutGeofenceRequestEntry
newBatchPutGeofenceRequestEntry
  Text
pGeofenceId_
  GeofenceGeometry
pGeometry_ =
    BatchPutGeofenceRequestEntry'
      { $sel:geofenceId:BatchPutGeofenceRequestEntry' :: Text
geofenceId =
          Text
pGeofenceId_,
        $sel:geometry:BatchPutGeofenceRequestEntry' :: GeofenceGeometry
geometry = GeofenceGeometry
pGeometry_
      }

-- | The identifier for the geofence to be stored in a given geofence
-- collection.
batchPutGeofenceRequestEntry_geofenceId :: Lens.Lens' BatchPutGeofenceRequestEntry Prelude.Text
batchPutGeofenceRequestEntry_geofenceId :: Lens' BatchPutGeofenceRequestEntry Text
batchPutGeofenceRequestEntry_geofenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutGeofenceRequestEntry' {Text
geofenceId :: Text
$sel:geofenceId:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> Text
geofenceId} -> Text
geofenceId) (\s :: BatchPutGeofenceRequestEntry
s@BatchPutGeofenceRequestEntry' {} Text
a -> BatchPutGeofenceRequestEntry
s {$sel:geofenceId:BatchPutGeofenceRequestEntry' :: Text
geofenceId = Text
a} :: BatchPutGeofenceRequestEntry)

-- | Contains the details of the position of the geofence. Can be either a
-- polygon or a circle. Including both will return a validation error.
--
-- Each
-- <https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html geofence polygon>
-- can have a maximum of 1,000 vertices.
batchPutGeofenceRequestEntry_geometry :: Lens.Lens' BatchPutGeofenceRequestEntry GeofenceGeometry
batchPutGeofenceRequestEntry_geometry :: Lens' BatchPutGeofenceRequestEntry GeofenceGeometry
batchPutGeofenceRequestEntry_geometry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutGeofenceRequestEntry' {GeofenceGeometry
geometry :: GeofenceGeometry
$sel:geometry:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> GeofenceGeometry
geometry} -> GeofenceGeometry
geometry) (\s :: BatchPutGeofenceRequestEntry
s@BatchPutGeofenceRequestEntry' {} GeofenceGeometry
a -> BatchPutGeofenceRequestEntry
s {$sel:geometry:BatchPutGeofenceRequestEntry' :: GeofenceGeometry
geometry = GeofenceGeometry
a} :: BatchPutGeofenceRequestEntry)

instance
  Prelude.Hashable
    BatchPutGeofenceRequestEntry
  where
  hashWithSalt :: Int -> BatchPutGeofenceRequestEntry -> Int
hashWithSalt Int
_salt BatchPutGeofenceRequestEntry' {Text
GeofenceGeometry
geometry :: GeofenceGeometry
geofenceId :: Text
$sel:geometry:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> GeofenceGeometry
$sel:geofenceId:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
geofenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GeofenceGeometry
geometry

instance Prelude.NFData BatchPutGeofenceRequestEntry where
  rnf :: BatchPutGeofenceRequestEntry -> ()
rnf BatchPutGeofenceRequestEntry' {Text
GeofenceGeometry
geometry :: GeofenceGeometry
geofenceId :: Text
$sel:geometry:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> GeofenceGeometry
$sel:geofenceId:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
geofenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GeofenceGeometry
geometry

instance Data.ToJSON BatchPutGeofenceRequestEntry where
  toJSON :: BatchPutGeofenceRequestEntry -> Value
toJSON BatchPutGeofenceRequestEntry' {Text
GeofenceGeometry
geometry :: GeofenceGeometry
geofenceId :: Text
$sel:geometry:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> GeofenceGeometry
$sel:geofenceId:BatchPutGeofenceRequestEntry' :: BatchPutGeofenceRequestEntry -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"GeofenceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
geofenceId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Geometry" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GeofenceGeometry
geometry)
          ]
      )