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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types.BatchItemError
import qualified Amazonka.Prelude as Prelude

-- | Contains error details for each geofence that failed to delete from the
-- geofence collection.
--
-- /See:/ 'newBatchDeleteGeofenceError' smart constructor.
data BatchDeleteGeofenceError = BatchDeleteGeofenceError'
  { -- | Contains details associated to the batch error.
    BatchDeleteGeofenceError -> BatchItemError
error :: BatchItemError,
    -- | The geofence associated with the error message.
    BatchDeleteGeofenceError -> Text
geofenceId :: Prelude.Text
  }
  deriving (BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool
(BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool)
-> (BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool)
-> Eq BatchDeleteGeofenceError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool
$c/= :: BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool
== :: BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool
$c== :: BatchDeleteGeofenceError -> BatchDeleteGeofenceError -> Bool
Prelude.Eq, ReadPrec [BatchDeleteGeofenceError]
ReadPrec BatchDeleteGeofenceError
Int -> ReadS BatchDeleteGeofenceError
ReadS [BatchDeleteGeofenceError]
(Int -> ReadS BatchDeleteGeofenceError)
-> ReadS [BatchDeleteGeofenceError]
-> ReadPrec BatchDeleteGeofenceError
-> ReadPrec [BatchDeleteGeofenceError]
-> Read BatchDeleteGeofenceError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteGeofenceError]
$creadListPrec :: ReadPrec [BatchDeleteGeofenceError]
readPrec :: ReadPrec BatchDeleteGeofenceError
$creadPrec :: ReadPrec BatchDeleteGeofenceError
readList :: ReadS [BatchDeleteGeofenceError]
$creadList :: ReadS [BatchDeleteGeofenceError]
readsPrec :: Int -> ReadS BatchDeleteGeofenceError
$creadsPrec :: Int -> ReadS BatchDeleteGeofenceError
Prelude.Read, Int -> BatchDeleteGeofenceError -> ShowS
[BatchDeleteGeofenceError] -> ShowS
BatchDeleteGeofenceError -> String
(Int -> BatchDeleteGeofenceError -> ShowS)
-> (BatchDeleteGeofenceError -> String)
-> ([BatchDeleteGeofenceError] -> ShowS)
-> Show BatchDeleteGeofenceError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteGeofenceError] -> ShowS
$cshowList :: [BatchDeleteGeofenceError] -> ShowS
show :: BatchDeleteGeofenceError -> String
$cshow :: BatchDeleteGeofenceError -> String
showsPrec :: Int -> BatchDeleteGeofenceError -> ShowS
$cshowsPrec :: Int -> BatchDeleteGeofenceError -> ShowS
Prelude.Show, (forall x.
 BatchDeleteGeofenceError -> Rep BatchDeleteGeofenceError x)
-> (forall x.
    Rep BatchDeleteGeofenceError x -> BatchDeleteGeofenceError)
-> Generic BatchDeleteGeofenceError
forall x.
Rep BatchDeleteGeofenceError x -> BatchDeleteGeofenceError
forall x.
BatchDeleteGeofenceError -> Rep BatchDeleteGeofenceError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeleteGeofenceError x -> BatchDeleteGeofenceError
$cfrom :: forall x.
BatchDeleteGeofenceError -> Rep BatchDeleteGeofenceError x
Prelude.Generic)

-- |
-- Create a value of 'BatchDeleteGeofenceError' 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:
--
-- 'error', 'batchDeleteGeofenceError_error' - Contains details associated to the batch error.
--
-- 'geofenceId', 'batchDeleteGeofenceError_geofenceId' - The geofence associated with the error message.
newBatchDeleteGeofenceError ::
  -- | 'error'
  BatchItemError ->
  -- | 'geofenceId'
  Prelude.Text ->
  BatchDeleteGeofenceError
newBatchDeleteGeofenceError :: BatchItemError -> Text -> BatchDeleteGeofenceError
newBatchDeleteGeofenceError BatchItemError
pError_ Text
pGeofenceId_ =
  BatchDeleteGeofenceError' :: BatchItemError -> Text -> BatchDeleteGeofenceError
BatchDeleteGeofenceError'
    { $sel:error:BatchDeleteGeofenceError' :: BatchItemError
error = BatchItemError
pError_,
      $sel:geofenceId:BatchDeleteGeofenceError' :: Text
geofenceId = Text
pGeofenceId_
    }

-- | Contains details associated to the batch error.
batchDeleteGeofenceError_error :: Lens.Lens' BatchDeleteGeofenceError BatchItemError
batchDeleteGeofenceError_error :: (BatchItemError -> f BatchItemError)
-> BatchDeleteGeofenceError -> f BatchDeleteGeofenceError
batchDeleteGeofenceError_error = (BatchDeleteGeofenceError -> BatchItemError)
-> (BatchDeleteGeofenceError
    -> BatchItemError -> BatchDeleteGeofenceError)
-> Lens
     BatchDeleteGeofenceError
     BatchDeleteGeofenceError
     BatchItemError
     BatchItemError
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofenceError' {BatchItemError
error :: BatchItemError
$sel:error:BatchDeleteGeofenceError' :: BatchDeleteGeofenceError -> BatchItemError
error} -> BatchItemError
error) (\s :: BatchDeleteGeofenceError
s@BatchDeleteGeofenceError' {} BatchItemError
a -> BatchDeleteGeofenceError
s {$sel:error:BatchDeleteGeofenceError' :: BatchItemError
error = BatchItemError
a} :: BatchDeleteGeofenceError)

-- | The geofence associated with the error message.
batchDeleteGeofenceError_geofenceId :: Lens.Lens' BatchDeleteGeofenceError Prelude.Text
batchDeleteGeofenceError_geofenceId :: (Text -> f Text)
-> BatchDeleteGeofenceError -> f BatchDeleteGeofenceError
batchDeleteGeofenceError_geofenceId = (BatchDeleteGeofenceError -> Text)
-> (BatchDeleteGeofenceError -> Text -> BatchDeleteGeofenceError)
-> Lens BatchDeleteGeofenceError BatchDeleteGeofenceError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofenceError' {Text
geofenceId :: Text
$sel:geofenceId:BatchDeleteGeofenceError' :: BatchDeleteGeofenceError -> Text
geofenceId} -> Text
geofenceId) (\s :: BatchDeleteGeofenceError
s@BatchDeleteGeofenceError' {} Text
a -> BatchDeleteGeofenceError
s {$sel:geofenceId:BatchDeleteGeofenceError' :: Text
geofenceId = Text
a} :: BatchDeleteGeofenceError)

instance Core.FromJSON BatchDeleteGeofenceError where
  parseJSON :: Value -> Parser BatchDeleteGeofenceError
parseJSON =
    String
-> (Object -> Parser BatchDeleteGeofenceError)
-> Value
-> Parser BatchDeleteGeofenceError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchDeleteGeofenceError"
      ( \Object
x ->
          BatchItemError -> Text -> BatchDeleteGeofenceError
BatchDeleteGeofenceError'
            (BatchItemError -> Text -> BatchDeleteGeofenceError)
-> Parser BatchItemError
-> Parser (Text -> BatchDeleteGeofenceError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser BatchItemError
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Error")
            Parser (Text -> BatchDeleteGeofenceError)
-> Parser Text -> Parser BatchDeleteGeofenceError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GeofenceId")
      )

instance Prelude.Hashable BatchDeleteGeofenceError

instance Prelude.NFData BatchDeleteGeofenceError