{-# 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-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.BatchEvaluateGeofencesError 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 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 -> ISO8601
sampleTime :: Data.ISO8601
  }
  deriving (BatchEvaluateGeofencesError -> BatchEvaluateGeofencesError -> Bool
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]
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
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.
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'
      { $sel:deviceId:BatchEvaluateGeofencesError' :: Text
deviceId = Text
pDeviceId_,
        $sel:error:BatchEvaluateGeofencesError' :: BatchItemError
error = BatchItemError
pError_,
        $sel:sampleTime:BatchEvaluateGeofencesError' :: 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 position evaluation error.
batchEvaluateGeofencesError_deviceId :: Lens.Lens' BatchEvaluateGeofencesError Prelude.Text
batchEvaluateGeofencesError_deviceId :: Lens' BatchEvaluateGeofencesError Text
batchEvaluateGeofencesError_deviceId = 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 :: Lens' BatchEvaluateGeofencesError BatchItemError
batchEvaluateGeofencesError_error = 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 :: Lens' BatchEvaluateGeofencesError UTCTime
batchEvaluateGeofencesError_sampleTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesError' {ISO8601
sampleTime :: ISO8601
$sel:sampleTime:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> ISO8601
sampleTime} -> ISO8601
sampleTime) (\s :: BatchEvaluateGeofencesError
s@BatchEvaluateGeofencesError' {} ISO8601
a -> BatchEvaluateGeofencesError
s {$sel:sampleTime:BatchEvaluateGeofencesError' :: ISO8601
sampleTime = ISO8601
a} :: BatchEvaluateGeofencesError) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON BatchEvaluateGeofencesError where
  parseJSON :: Value -> Parser BatchEvaluateGeofencesError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchEvaluateGeofencesError"
      ( \Object
x ->
          Text -> BatchItemError -> ISO8601 -> BatchEvaluateGeofencesError
BatchEvaluateGeofencesError'
            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 BatchEvaluateGeofencesError where
  hashWithSalt :: Int -> BatchEvaluateGeofencesError -> Int
hashWithSalt Int
_salt BatchEvaluateGeofencesError' {Text
ISO8601
BatchItemError
sampleTime :: ISO8601
error :: BatchItemError
deviceId :: Text
$sel:sampleTime:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> ISO8601
$sel:error:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> BatchItemError
$sel:deviceId:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> 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 BatchEvaluateGeofencesError where
  rnf :: BatchEvaluateGeofencesError -> ()
rnf BatchEvaluateGeofencesError' {Text
ISO8601
BatchItemError
sampleTime :: ISO8601
error :: BatchItemError
deviceId :: Text
$sel:sampleTime:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> ISO8601
$sel:error:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> BatchItemError
$sel:deviceId:BatchEvaluateGeofencesError' :: BatchEvaluateGeofencesError -> 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