{-# 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-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.BatchGetDevicePositionError 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 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
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]
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
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.
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'
    { $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 :: Lens' BatchGetDevicePositionError Text
batchGetDevicePositionError_deviceId = 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 :: Lens' BatchGetDevicePositionError BatchItemError
batchGetDevicePositionError_error = 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 Data.FromJSON BatchGetDevicePositionError where
  parseJSON :: Value -> Parser BatchGetDevicePositionError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchGetDevicePositionError"
      ( \Object
x ->
          Text -> BatchItemError -> BatchGetDevicePositionError
BatchGetDevicePositionError'
            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
"DeviceId")
            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
"Error")
      )

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

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