{-# 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-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.BatchPutGeofenceError 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 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
(BatchPutGeofenceError -> BatchPutGeofenceError -> Bool)
-> (BatchPutGeofenceError -> BatchPutGeofenceError -> Bool)
-> Eq BatchPutGeofenceError
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]
(Int -> ReadS BatchPutGeofenceError)
-> ReadS [BatchPutGeofenceError]
-> ReadPrec BatchPutGeofenceError
-> ReadPrec [BatchPutGeofenceError]
-> Read 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
(Int -> BatchPutGeofenceError -> ShowS)
-> (BatchPutGeofenceError -> String)
-> ([BatchPutGeofenceError] -> ShowS)
-> Show BatchPutGeofenceError
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. BatchPutGeofenceError -> Rep BatchPutGeofenceError x)
-> (forall x. Rep BatchPutGeofenceError x -> BatchPutGeofenceError)
-> Generic BatchPutGeofenceError
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' :: BatchItemError -> Text -> BatchPutGeofenceError
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 :: (BatchItemError -> f BatchItemError)
-> BatchPutGeofenceError -> f BatchPutGeofenceError
batchPutGeofenceError_error = (BatchPutGeofenceError -> BatchItemError)
-> (BatchPutGeofenceError
    -> BatchItemError -> BatchPutGeofenceError)
-> Lens
     BatchPutGeofenceError
     BatchPutGeofenceError
     BatchItemError
     BatchItemError
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 :: (Text -> f Text)
-> BatchPutGeofenceError -> f BatchPutGeofenceError
batchPutGeofenceError_geofenceId = (BatchPutGeofenceError -> Text)
-> (BatchPutGeofenceError -> Text -> BatchPutGeofenceError)
-> Lens BatchPutGeofenceError BatchPutGeofenceError Text Text
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 Core.FromJSON BatchPutGeofenceError where
  parseJSON :: Value -> Parser BatchPutGeofenceError
parseJSON =
    String
-> (Object -> Parser BatchPutGeofenceError)
-> Value
-> Parser BatchPutGeofenceError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchPutGeofenceError"
      ( \Object
x ->
          BatchItemError -> Text -> BatchPutGeofenceError
BatchPutGeofenceError'
            (BatchItemError -> Text -> BatchPutGeofenceError)
-> Parser BatchItemError -> Parser (Text -> BatchPutGeofenceError)
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 -> BatchPutGeofenceError)
-> Parser Text -> Parser BatchPutGeofenceError
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 BatchPutGeofenceError

instance Prelude.NFData BatchPutGeofenceError