{-# 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-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.BatchUpdateDevicePositionError 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 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 -> POSIX
sampleTime :: Core.POSIX
  }
  deriving (BatchUpdateDevicePositionError
-> BatchUpdateDevicePositionError -> Bool
(BatchUpdateDevicePositionError
 -> BatchUpdateDevicePositionError -> Bool)
-> (BatchUpdateDevicePositionError
    -> BatchUpdateDevicePositionError -> Bool)
-> Eq BatchUpdateDevicePositionError
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]
(Int -> ReadS BatchUpdateDevicePositionError)
-> ReadS [BatchUpdateDevicePositionError]
-> ReadPrec BatchUpdateDevicePositionError
-> ReadPrec [BatchUpdateDevicePositionError]
-> Read 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
(Int -> BatchUpdateDevicePositionError -> ShowS)
-> (BatchUpdateDevicePositionError -> String)
-> ([BatchUpdateDevicePositionError] -> ShowS)
-> Show BatchUpdateDevicePositionError
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.
 BatchUpdateDevicePositionError
 -> Rep BatchUpdateDevicePositionError x)
-> (forall x.
    Rep BatchUpdateDevicePositionError x
    -> BatchUpdateDevicePositionError)
-> Generic BatchUpdateDevicePositionError
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' :: Text -> BatchItemError -> POSIX -> BatchUpdateDevicePositionError
BatchUpdateDevicePositionError'
      { $sel:deviceId:BatchUpdateDevicePositionError' :: Text
deviceId =
          Text
pDeviceId_,
        $sel:error:BatchUpdateDevicePositionError' :: BatchItemError
error = BatchItemError
pError_,
        $sel:sampleTime:BatchUpdateDevicePositionError' :: POSIX
sampleTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
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 :: (Text -> f Text)
-> BatchUpdateDevicePositionError
-> f BatchUpdateDevicePositionError
batchUpdateDevicePositionError_deviceId = (BatchUpdateDevicePositionError -> Text)
-> (BatchUpdateDevicePositionError
    -> Text -> BatchUpdateDevicePositionError)
-> Lens
     BatchUpdateDevicePositionError
     BatchUpdateDevicePositionError
     Text
     Text
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 :: (BatchItemError -> f BatchItemError)
-> BatchUpdateDevicePositionError
-> f BatchUpdateDevicePositionError
batchUpdateDevicePositionError_error = (BatchUpdateDevicePositionError -> BatchItemError)
-> (BatchUpdateDevicePositionError
    -> BatchItemError -> BatchUpdateDevicePositionError)
-> Lens
     BatchUpdateDevicePositionError
     BatchUpdateDevicePositionError
     BatchItemError
     BatchItemError
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 :: (UTCTime -> f UTCTime)
-> BatchUpdateDevicePositionError
-> f BatchUpdateDevicePositionError
batchUpdateDevicePositionError_sampleTime = (BatchUpdateDevicePositionError -> POSIX)
-> (BatchUpdateDevicePositionError
    -> POSIX -> BatchUpdateDevicePositionError)
-> Lens
     BatchUpdateDevicePositionError
     BatchUpdateDevicePositionError
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDevicePositionError' {POSIX
sampleTime :: POSIX
$sel:sampleTime:BatchUpdateDevicePositionError' :: BatchUpdateDevicePositionError -> POSIX
sampleTime} -> POSIX
sampleTime) (\s :: BatchUpdateDevicePositionError
s@BatchUpdateDevicePositionError' {} POSIX
a -> BatchUpdateDevicePositionError
s {$sel:sampleTime:BatchUpdateDevicePositionError' :: POSIX
sampleTime = POSIX
a} :: BatchUpdateDevicePositionError) ((POSIX -> f POSIX)
 -> BatchUpdateDevicePositionError
 -> f BatchUpdateDevicePositionError)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> BatchUpdateDevicePositionError
-> f BatchUpdateDevicePositionError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance
  Prelude.Hashable
    BatchUpdateDevicePositionError

instance
  Prelude.NFData
    BatchUpdateDevicePositionError