{-# 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.BatchUpdateDevicePositionError
-- 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.BatchUpdateDevicePositionError 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 failed to update its
-- position.
--
-- /See:/ 'newBatchUpdateDevicePositionError' smart constructor.
data BatchUpdateDevicePositionError = BatchUpdateDevicePositionError'
  { -- | The device associated with the failed location update.
    BatchUpdateDevicePositionError -> Text
deviceId :: Prelude.Text,
    -- | Contains details related to the error code such as the error code and
    -- error message.
    BatchUpdateDevicePositionError -> BatchItemError
error :: BatchItemError,
    -- | The timestamp at which the device position was determined. Uses
    -- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
    -- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
    BatchUpdateDevicePositionError -> ISO8601
sampleTime :: Data.ISO8601
  }
  deriving (BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
$c/= :: BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
== :: BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
$c== :: BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
Prelude.Eq, ReadPrec [BatchUpdateDevicePositionError]
ReadPrec BatchUpdateDevicePositionError
Int -> ReadS BatchUpdateDevicePositionError
ReadS [BatchUpdateDevicePositionError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateDevicePositionError]
$creadListPrec :: ReadPrec [BatchUpdateDevicePositionError]
readPrec :: ReadPrec BatchUpdateDevicePositionError
$creadPrec :: ReadPrec BatchUpdateDevicePositionError
readList :: ReadS [BatchUpdateDevicePositionError]
$creadList :: ReadS [BatchUpdateDevicePositionError]
readsPrec :: Int -> ReadS BatchUpdateDevicePositionError
$creadsPrec :: Int -> ReadS BatchUpdateDevicePositionError
Prelude.Read, Int -> BatchUpdateDevicePositionError -> ShowS
[BatchUpdateDevicePositionError] -> ShowS
BatchUpdateDevicePositionError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateDevicePositionError] -> ShowS
$cshowList :: [BatchUpdateDevicePositionError] -> ShowS
show :: BatchUpdateDevicePositionError -> String
$cshow :: BatchUpdateDevicePositionError -> String
showsPrec :: Int -> BatchUpdateDevicePositionError -> ShowS
$cshowsPrec :: Int -> BatchUpdateDevicePositionError -> ShowS
Prelude.Show, forall x.
Rep BatchUpdateDevicePositionError x
-> BatchUpdateDevicePositionError
forall x.
BatchUpdateDevicePositionError
-> Rep BatchUpdateDevicePositionError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateDevicePositionError x
-> BatchUpdateDevicePositionError
$cfrom :: forall x.
BatchUpdateDevicePositionError
-> Rep BatchUpdateDevicePositionError x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateDevicePositionError' 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', 'batchUpdateDevicePositionError_deviceId' - The device associated with the failed location update.
--
-- 'error', 'batchUpdateDevicePositionError_error' - Contains details related to the error code such as the error code and
-- error message.
--
-- 'sampleTime', 'batchUpdateDevicePositionError_sampleTime' - The timestamp at which the device position was determined. Uses
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
newBatchUpdateDevicePositionError ::
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'error'
  BatchItemError ->
  -- | 'sampleTime'
  Prelude.UTCTime ->
  BatchUpdateDevicePositionError
newBatchUpdateDevicePositionError :: Text -> BatchItemError -> UTCTime -> BatchUpdateDevicePositionError
newBatchUpdateDevicePositionError
  Text
pDeviceId_
  BatchItemError
pError_
  UTCTime
pSampleTime_ =
    BatchUpdateDevicePositionError'
      { $sel:deviceId:BatchUpdateDevicePositionError' :: Text
deviceId =
          Text
pDeviceId_,
        $sel:error:BatchUpdateDevicePositionError' :: BatchItemError
error = BatchItemError
pError_,
        $sel:sampleTime:BatchUpdateDevicePositionError' :: ISO8601
sampleTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSampleTime_
      }

-- | The device associated with the failed location update.
batchUpdateDevicePositionError_deviceId :: Lens.Lens' BatchUpdateDevicePositionError Prelude.Text
batchUpdateDevicePositionError_deviceId :: Lens' BatchUpdateDevicePositionError Text
batchUpdateDevicePositionError_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDevicePositionError' {Text
deviceId :: Text
$sel:deviceId:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> Text
deviceId} -> Text
deviceId) (\s :: BatchUpdateDevicePositionError
s@BatchUpdateDevicePositionError' {} Text
a -> BatchUpdateDevicePositionError
s {$sel:deviceId:BatchUpdateDevicePositionError' :: Text
deviceId = Text
a} :: BatchUpdateDevicePositionError)

-- | Contains details related to the error code such as the error code and
-- error message.
batchUpdateDevicePositionError_error :: Lens.Lens' BatchUpdateDevicePositionError BatchItemError
batchUpdateDevicePositionError_error :: Lens' BatchUpdateDevicePositionError BatchItemError
batchUpdateDevicePositionError_error = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDevicePositionError' {BatchItemError
error :: BatchItemError
$sel:error:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> BatchItemError
error} -> BatchItemError
error) (\s :: BatchUpdateDevicePositionError
s@BatchUpdateDevicePositionError' {} BatchItemError
a -> BatchUpdateDevicePositionError
s {$sel:error:BatchUpdateDevicePositionError' :: BatchItemError
error = BatchItemError
a} :: BatchUpdateDevicePositionError)

-- | The timestamp at which the device position was determined. Uses
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
batchUpdateDevicePositionError_sampleTime :: Lens.Lens' BatchUpdateDevicePositionError Prelude.UTCTime
batchUpdateDevicePositionError_sampleTime :: Lens' BatchUpdateDevicePositionError UTCTime
batchUpdateDevicePositionError_sampleTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDevicePositionError' {ISO8601
sampleTime :: ISO8601
$sel:sampleTime:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> ISO8601
sampleTime} -> ISO8601
sampleTime) (\s :: BatchUpdateDevicePositionError
s@BatchUpdateDevicePositionError' {} ISO8601
a -> BatchUpdateDevicePositionError
s {$sel:sampleTime:BatchUpdateDevicePositionError' :: ISO8601
sampleTime = ISO8601
a} :: BatchUpdateDevicePositionError) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance
  Prelude.Hashable
    BatchUpdateDevicePositionError
  where
  hashWithSalt :: Int -> BatchUpdateDevicePositionError -> Int
hashWithSalt
    Int
_salt
    BatchUpdateDevicePositionError' {Text
ISO8601
BatchItemError
sampleTime :: ISO8601
error :: BatchItemError
deviceId :: Text
$sel:sampleTime:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> ISO8601
$sel:error:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> BatchItemError
$sel:deviceId:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> 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
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
sampleTime

instance
  Prelude.NFData
    BatchUpdateDevicePositionError
  where
  rnf :: BatchUpdateDevicePositionError -> ()
rnf BatchUpdateDevicePositionError' {Text
ISO8601
BatchItemError
sampleTime :: ISO8601
error :: BatchItemError
deviceId :: Text
$sel:sampleTime:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> ISO8601
$sel:error:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> BatchItemError
$sel:deviceId:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
sampleTime