{-# 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.BatchPutGeofenceError
-- 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.BatchPutGeofenceError 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.BatchItemError
import qualified Amazonka.Prelude as Prelude

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

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

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

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

instance Data.FromJSON BatchPutGeofenceError where
  parseJSON :: Value -> Parser BatchPutGeofenceError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchPutGeofenceError"
      ( \Object
x ->
          BatchItemError -> Text -> BatchPutGeofenceError
BatchPutGeofenceError'
            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
"Error")
            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
"GeofenceId")
      )

instance Prelude.Hashable BatchPutGeofenceError where
  hashWithSalt :: Int -> BatchPutGeofenceError -> Int
hashWithSalt Int
_salt BatchPutGeofenceError' {Text
BatchItemError
geofenceId :: Text
error :: BatchItemError
$sel:geofenceId:BatchPutGeofenceError' :: BatchPutGeofenceError -> Text
$sel:error:BatchPutGeofenceError' :: BatchPutGeofenceError -> BatchItemError
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BatchItemError
error
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
geofenceId

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