{-# 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.BatchGetDevicePositionError
-- 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.BatchGetDevicePositionError 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 device that didn\'t return a position.
--
-- /See:/ 'newBatchGetDevicePositionError' smart constructor.
data BatchGetDevicePositionError = BatchGetDevicePositionError'
  { -- | The ID of the device that didn\'t return a position.
    BatchGetDevicePositionError -> Text
deviceId :: Prelude.Text,
    -- | Contains details related to the error code.
    BatchGetDevicePositionError -> BatchItemError
error :: BatchItemError
  }
  deriving (BatchGetDevicePositionError -> BatchGetDevicePositionError -> Bool
(BatchGetDevicePositionError
 -> BatchGetDevicePositionError -> Bool)
-> (BatchGetDevicePositionError
    -> BatchGetDevicePositionError -> Bool)
-> Eq BatchGetDevicePositionError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetDevicePositionError -> BatchGetDevicePositionError -> Bool
$c/= :: BatchGetDevicePositionError -> BatchGetDevicePositionError -> Bool
== :: BatchGetDevicePositionError -> BatchGetDevicePositionError -> Bool
$c== :: BatchGetDevicePositionError -> BatchGetDevicePositionError -> Bool
Prelude.Eq, ReadPrec [BatchGetDevicePositionError]
ReadPrec BatchGetDevicePositionError
Int -> ReadS BatchGetDevicePositionError
ReadS [BatchGetDevicePositionError]
(Int -> ReadS BatchGetDevicePositionError)
-> ReadS [BatchGetDevicePositionError]
-> ReadPrec BatchGetDevicePositionError
-> ReadPrec [BatchGetDevicePositionError]
-> Read BatchGetDevicePositionError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetDevicePositionError]
$creadListPrec :: ReadPrec [BatchGetDevicePositionError]
readPrec :: ReadPrec BatchGetDevicePositionError
$creadPrec :: ReadPrec BatchGetDevicePositionError
readList :: ReadS [BatchGetDevicePositionError]
$creadList :: ReadS [BatchGetDevicePositionError]
readsPrec :: Int -> ReadS BatchGetDevicePositionError
$creadsPrec :: Int -> ReadS BatchGetDevicePositionError
Prelude.Read, Int -> BatchGetDevicePositionError -> ShowS
[BatchGetDevicePositionError] -> ShowS
BatchGetDevicePositionError -> String
(Int -> BatchGetDevicePositionError -> ShowS)
-> (BatchGetDevicePositionError -> String)
-> ([BatchGetDevicePositionError] -> ShowS)
-> Show BatchGetDevicePositionError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetDevicePositionError] -> ShowS
$cshowList :: [BatchGetDevicePositionError] -> ShowS
show :: BatchGetDevicePositionError -> String
$cshow :: BatchGetDevicePositionError -> String
showsPrec :: Int -> BatchGetDevicePositionError -> ShowS
$cshowsPrec :: Int -> BatchGetDevicePositionError -> ShowS
Prelude.Show, (forall x.
 BatchGetDevicePositionError -> Rep BatchGetDevicePositionError x)
-> (forall x.
    Rep BatchGetDevicePositionError x -> BatchGetDevicePositionError)
-> Generic BatchGetDevicePositionError
forall x.
Rep BatchGetDevicePositionError x -> BatchGetDevicePositionError
forall x.
BatchGetDevicePositionError -> Rep BatchGetDevicePositionError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetDevicePositionError x -> BatchGetDevicePositionError
$cfrom :: forall x.
BatchGetDevicePositionError -> Rep BatchGetDevicePositionError x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetDevicePositionError' 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:
--
-- 'deviceId', 'batchGetDevicePositionError_deviceId' - The ID of the device that didn\'t return a position.
--
-- 'error', 'batchGetDevicePositionError_error' - Contains details related to the error code.
newBatchGetDevicePositionError ::
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'error'
  BatchItemError ->
  BatchGetDevicePositionError
newBatchGetDevicePositionError :: Text -> BatchItemError -> BatchGetDevicePositionError
newBatchGetDevicePositionError Text
pDeviceId_ BatchItemError
pError_ =
  BatchGetDevicePositionError' :: Text -> BatchItemError -> BatchGetDevicePositionError
BatchGetDevicePositionError'
    { $sel:deviceId:BatchGetDevicePositionError' :: Text
deviceId = Text
pDeviceId_,
      $sel:error:BatchGetDevicePositionError' :: BatchItemError
error = BatchItemError
pError_
    }

-- | The ID of the device that didn\'t return a position.
batchGetDevicePositionError_deviceId :: Lens.Lens' BatchGetDevicePositionError Prelude.Text
batchGetDevicePositionError_deviceId :: (Text -> f Text)
-> BatchGetDevicePositionError -> f BatchGetDevicePositionError
batchGetDevicePositionError_deviceId = (BatchGetDevicePositionError -> Text)
-> (BatchGetDevicePositionError
    -> Text -> BatchGetDevicePositionError)
-> Lens
     BatchGetDevicePositionError BatchGetDevicePositionError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetDevicePositionError' {Text
deviceId :: Text
$sel:deviceId:BatchGetDevicePositionError' :: BatchGetDevicePositionError -> Text
deviceId} -> Text
deviceId) (\s :: BatchGetDevicePositionError
s@BatchGetDevicePositionError' {} Text
a -> BatchGetDevicePositionError
s {$sel:deviceId:BatchGetDevicePositionError' :: Text
deviceId = Text
a} :: BatchGetDevicePositionError)

-- | Contains details related to the error code.
batchGetDevicePositionError_error :: Lens.Lens' BatchGetDevicePositionError BatchItemError
batchGetDevicePositionError_error :: (BatchItemError -> f BatchItemError)
-> BatchGetDevicePositionError -> f BatchGetDevicePositionError
batchGetDevicePositionError_error = (BatchGetDevicePositionError -> BatchItemError)
-> (BatchGetDevicePositionError
    -> BatchItemError -> BatchGetDevicePositionError)
-> Lens
     BatchGetDevicePositionError
     BatchGetDevicePositionError
     BatchItemError
     BatchItemError
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetDevicePositionError' {BatchItemError
error :: BatchItemError
$sel:error:BatchGetDevicePositionError' :: BatchGetDevicePositionError -> BatchItemError
error} -> BatchItemError
error) (\s :: BatchGetDevicePositionError
s@BatchGetDevicePositionError' {} BatchItemError
a -> BatchGetDevicePositionError
s {$sel:error:BatchGetDevicePositionError' :: BatchItemError
error = BatchItemError
a} :: BatchGetDevicePositionError)

instance Core.FromJSON BatchGetDevicePositionError where
  parseJSON :: Value -> Parser BatchGetDevicePositionError
parseJSON =
    String
-> (Object -> Parser BatchGetDevicePositionError)
-> Value
-> Parser BatchGetDevicePositionError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchGetDevicePositionError"
      ( \Object
x ->
          Text -> BatchItemError -> BatchGetDevicePositionError
BatchGetDevicePositionError'
            (Text -> BatchItemError -> BatchGetDevicePositionError)
-> Parser Text
-> Parser (BatchItemError -> BatchGetDevicePositionError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DeviceId")
            Parser (BatchItemError -> BatchGetDevicePositionError)
-> Parser BatchItemError -> Parser BatchGetDevicePositionError
forall (f :: * -> *) a b. Applicative f => 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")
      )

instance Prelude.Hashable BatchGetDevicePositionError

instance Prelude.NFData BatchGetDevicePositionError