{-# 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.BatchEvaluateGeofencesError
-- 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.BatchEvaluateGeofencesError 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 evaluate its
-- position against the geofences in a given geofence collection.
--
-- /See:/ 'newBatchEvaluateGeofencesError' smart constructor.
data BatchEvaluateGeofencesError = BatchEvaluateGeofencesError'
  { -- | The device associated with the position evaluation error.
    BatchEvaluateGeofencesError -> Text
deviceId :: Prelude.Text,
    -- | Contains details associated to the batch error.
    BatchEvaluateGeofencesError -> BatchItemError
error :: BatchItemError,
    -- | Specifies a timestamp for when the error occurred in
    -- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
    -- format: @YYYY-MM-DDThh:mm:ss.sssZ@
    BatchEvaluateGeofencesError -> POSIX
sampleTime :: Core.POSIX
  }
  deriving (BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
(BatchEvaluateGeofencesError
 -> BatchEvaluateGeofencesError -> Bool)
-> (BatchEvaluateGeofencesError
    -> BatchEvaluateGeofencesError -> Bool)
-> Eq BatchEvaluateGeofencesError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
$c/= :: BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
== :: BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
$c== :: BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
Prelude.Eq, ReadPrec [BatchEvaluateGeofencesError]
ReadPrec BatchEvaluateGeofencesError
Int -> ReadS BatchEvaluateGeofencesError
ReadS [BatchEvaluateGeofencesError]
(Int -> ReadS BatchEvaluateGeofencesError)
-> ReadS [BatchEvaluateGeofencesError]
-> ReadPrec BatchEvaluateGeofencesError
-> ReadPrec [BatchEvaluateGeofencesError]
-> Read BatchEvaluateGeofencesError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEvaluateGeofencesError]
$creadListPrec :: ReadPrec [BatchEvaluateGeofencesError]
readPrec :: ReadPrec BatchEvaluateGeofencesError
$creadPrec :: ReadPrec BatchEvaluateGeofencesError
readList :: ReadS [BatchEvaluateGeofencesError]
$creadList :: ReadS [BatchEvaluateGeofencesError]
readsPrec :: Int -> ReadS BatchEvaluateGeofencesError
$creadsPrec :: Int -> ReadS BatchEvaluateGeofencesError
Prelude.Read, Int -> BatchEvaluateGeofencesError -> ShowS
[BatchEvaluateGeofencesError] -> ShowS
BatchEvaluateGeofencesError -> String
(Int -> BatchEvaluateGeofencesError -> ShowS)
-> (BatchEvaluateGeofencesError -> String)
-> ([BatchEvaluateGeofencesError] -> ShowS)
-> Show BatchEvaluateGeofencesError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEvaluateGeofencesError] -> ShowS
$cshowList :: [BatchEvaluateGeofencesError] -> ShowS
show :: BatchEvaluateGeofencesError -> String
$cshow :: BatchEvaluateGeofencesError -> String
showsPrec :: Int -> BatchEvaluateGeofencesError -> ShowS
$cshowsPrec :: Int -> BatchEvaluateGeofencesError -> ShowS
Prelude.Show, (forall x.
 BatchEvaluateGeofencesError -> Rep BatchEvaluateGeofencesError x)
-> (forall x.
    Rep BatchEvaluateGeofencesError x -> BatchEvaluateGeofencesError)
-> Generic BatchEvaluateGeofencesError
forall x.
Rep BatchEvaluateGeofencesError x -> BatchEvaluateGeofencesError
forall x.
BatchEvaluateGeofencesError -> Rep BatchEvaluateGeofencesError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchEvaluateGeofencesError x -> BatchEvaluateGeofencesError
$cfrom :: forall x.
BatchEvaluateGeofencesError -> Rep BatchEvaluateGeofencesError x
Prelude.Generic)

-- |
-- Create a value of 'BatchEvaluateGeofencesError' 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', 'batchEvaluateGeofencesError_deviceId' - The device associated with the position evaluation error.
--
-- 'error', 'batchEvaluateGeofencesError_error' - Contains details associated to the batch error.
--
-- 'sampleTime', 'batchEvaluateGeofencesError_sampleTime' - Specifies a timestamp for when the error occurred in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@
newBatchEvaluateGeofencesError ::
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'error'
  BatchItemError ->
  -- | 'sampleTime'
  Prelude.UTCTime ->
  BatchEvaluateGeofencesError
newBatchEvaluateGeofencesError :: Text -> BatchItemError -> UTCTime -> BatchEvaluateGeofencesError
newBatchEvaluateGeofencesError
  Text
pDeviceId_
  BatchItemError
pError_
  UTCTime
pSampleTime_ =
    BatchEvaluateGeofencesError' :: Text -> BatchItemError -> POSIX -> BatchEvaluateGeofencesError
BatchEvaluateGeofencesError'
      { $sel:deviceId:BatchEvaluateGeofencesError' :: Text
deviceId = Text
pDeviceId_,
        $sel:error:BatchEvaluateGeofencesError' :: BatchItemError
error = BatchItemError
pError_,
        $sel:sampleTime:BatchEvaluateGeofencesError' :: 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 position evaluation error.
batchEvaluateGeofencesError_deviceId :: Lens.Lens' BatchEvaluateGeofencesError Prelude.Text
batchEvaluateGeofencesError_deviceId :: (Text -> f Text)
-> BatchEvaluateGeofencesError -> f BatchEvaluateGeofencesError
batchEvaluateGeofencesError_deviceId = (BatchEvaluateGeofencesError -> Text)
-> (BatchEvaluateGeofencesError
    -> Text -> BatchEvaluateGeofencesError)
-> Lens
     BatchEvaluateGeofencesError BatchEvaluateGeofencesError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesError' {Text
deviceId :: Text
$sel:deviceId:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> Text
deviceId} -> Text
deviceId) (\s :: BatchEvaluateGeofencesError
s@BatchEvaluateGeofencesError' {} Text
a -> BatchEvaluateGeofencesError
s {$sel:deviceId:BatchEvaluateGeofencesError' :: Text
deviceId = Text
a} :: BatchEvaluateGeofencesError)

-- | Contains details associated to the batch error.
batchEvaluateGeofencesError_error :: Lens.Lens' BatchEvaluateGeofencesError BatchItemError
batchEvaluateGeofencesError_error :: (BatchItemError -> f BatchItemError)
-> BatchEvaluateGeofencesError -> f BatchEvaluateGeofencesError
batchEvaluateGeofencesError_error = (BatchEvaluateGeofencesError -> BatchItemError)
-> (BatchEvaluateGeofencesError
    -> BatchItemError -> BatchEvaluateGeofencesError)
-> Lens
     BatchEvaluateGeofencesError
     BatchEvaluateGeofencesError
     BatchItemError
     BatchItemError
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesError' {BatchItemError
error :: BatchItemError
$sel:error:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> BatchItemError
error} -> BatchItemError
error) (\s :: BatchEvaluateGeofencesError
s@BatchEvaluateGeofencesError' {} BatchItemError
a -> BatchEvaluateGeofencesError
s {$sel:error:BatchEvaluateGeofencesError' :: BatchItemError
error = BatchItemError
a} :: BatchEvaluateGeofencesError)

-- | Specifies a timestamp for when the error occurred in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@
batchEvaluateGeofencesError_sampleTime :: Lens.Lens' BatchEvaluateGeofencesError Prelude.UTCTime
batchEvaluateGeofencesError_sampleTime :: (UTCTime -> f UTCTime)
-> BatchEvaluateGeofencesError -> f BatchEvaluateGeofencesError
batchEvaluateGeofencesError_sampleTime = (BatchEvaluateGeofencesError -> POSIX)
-> (BatchEvaluateGeofencesError
    -> POSIX -> BatchEvaluateGeofencesError)
-> Lens
     BatchEvaluateGeofencesError BatchEvaluateGeofencesError POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesError' {POSIX
sampleTime :: POSIX
$sel:sampleTime:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> POSIX
sampleTime} -> POSIX
sampleTime) (\s :: BatchEvaluateGeofencesError
s@BatchEvaluateGeofencesError' {} POSIX
a -> BatchEvaluateGeofencesError
s {$sel:sampleTime:BatchEvaluateGeofencesError' :: POSIX
sampleTime = POSIX
a} :: BatchEvaluateGeofencesError) ((POSIX -> f POSIX)
 -> BatchEvaluateGeofencesError -> f BatchEvaluateGeofencesError)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> BatchEvaluateGeofencesError
-> f BatchEvaluateGeofencesError
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 BatchEvaluateGeofencesError where
  parseJSON :: Value -> Parser BatchEvaluateGeofencesError
parseJSON =
    String
-> (Object -> Parser BatchEvaluateGeofencesError)
-> Value
-> Parser BatchEvaluateGeofencesError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchEvaluateGeofencesError"
      ( \Object
x ->
          Text -> BatchItemError -> POSIX -> BatchEvaluateGeofencesError
BatchEvaluateGeofencesError'
            (Text -> BatchItemError -> POSIX -> BatchEvaluateGeofencesError)
-> Parser Text
-> Parser (BatchItemError -> POSIX -> BatchEvaluateGeofencesError)
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 -> BatchEvaluateGeofencesError)
-> Parser BatchItemError
-> Parser (POSIX -> BatchEvaluateGeofencesError)
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 -> BatchEvaluateGeofencesError)
-> Parser POSIX -> Parser BatchEvaluateGeofencesError
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 BatchEvaluateGeofencesError

instance Prelude.NFData BatchEvaluateGeofencesError