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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 polygon details to specify the position of the geofence.
    --
    -- 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
(BatchPutGeofenceRequestEntry
 -> BatchPutGeofenceRequestEntry -> Bool)
-> (BatchPutGeofenceRequestEntry
    -> BatchPutGeofenceRequestEntry -> Bool)
-> Eq BatchPutGeofenceRequestEntry
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
(Int -> BatchPutGeofenceRequestEntry -> ShowS)
-> (BatchPutGeofenceRequestEntry -> String)
-> ([BatchPutGeofenceRequestEntry] -> ShowS)
-> Show BatchPutGeofenceRequestEntry
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.
 BatchPutGeofenceRequestEntry -> Rep BatchPutGeofenceRequestEntry x)
-> (forall x.
    Rep BatchPutGeofenceRequestEntry x -> BatchPutGeofenceRequestEntry)
-> Generic BatchPutGeofenceRequestEntry
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 polygon details to specify the position of the geofence.
--
-- 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' :: Text -> GeofenceGeometry -> BatchPutGeofenceRequestEntry
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 :: (Text -> f Text)
-> BatchPutGeofenceRequestEntry -> f BatchPutGeofenceRequestEntry
batchPutGeofenceRequestEntry_geofenceId = (BatchPutGeofenceRequestEntry -> Text)
-> (BatchPutGeofenceRequestEntry
    -> Text -> BatchPutGeofenceRequestEntry)
-> Lens
     BatchPutGeofenceRequestEntry BatchPutGeofenceRequestEntry Text Text
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 polygon details to specify the position of the geofence.
--
-- 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 :: (GeofenceGeometry -> f GeofenceGeometry)
-> BatchPutGeofenceRequestEntry -> f BatchPutGeofenceRequestEntry
batchPutGeofenceRequestEntry_geometry = (BatchPutGeofenceRequestEntry -> GeofenceGeometry)
-> (BatchPutGeofenceRequestEntry
    -> GeofenceGeometry -> BatchPutGeofenceRequestEntry)
-> Lens
     BatchPutGeofenceRequestEntry
     BatchPutGeofenceRequestEntry
     GeofenceGeometry
     GeofenceGeometry
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

instance Prelude.NFData BatchPutGeofenceRequestEntry

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GeofenceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
geofenceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Geometry" Text -> GeofenceGeometry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GeofenceGeometry
geometry)
          ]
      )