{-# 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.IoTSiteWise.Types.BatchGetAssetPropertyValueHistoryErrorInfo
-- 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.IoTSiteWise.Types.BatchGetAssetPropertyValueHistoryErrorInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.BatchGetAssetPropertyValueHistoryErrorCode
import qualified Amazonka.Prelude as Prelude

-- | The error information, such as the error code and the timestamp.
--
-- /See:/ 'newBatchGetAssetPropertyValueHistoryErrorInfo' smart constructor.
data BatchGetAssetPropertyValueHistoryErrorInfo = BatchGetAssetPropertyValueHistoryErrorInfo'
  { -- | The error code.
    BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorCode
errorCode :: BatchGetAssetPropertyValueHistoryErrorCode,
    -- | The date the error occurred, in Unix epoch time.
    BatchGetAssetPropertyValueHistoryErrorInfo -> POSIX
errorTimestamp :: Data.POSIX
  }
  deriving (BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorInfo -> Bool
$c/= :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorInfo -> Bool
== :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorInfo -> Bool
$c== :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorInfo -> Bool
Prelude.Eq, ReadPrec [BatchGetAssetPropertyValueHistoryErrorInfo]
ReadPrec BatchGetAssetPropertyValueHistoryErrorInfo
Int -> ReadS BatchGetAssetPropertyValueHistoryErrorInfo
ReadS [BatchGetAssetPropertyValueHistoryErrorInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetAssetPropertyValueHistoryErrorInfo]
$creadListPrec :: ReadPrec [BatchGetAssetPropertyValueHistoryErrorInfo]
readPrec :: ReadPrec BatchGetAssetPropertyValueHistoryErrorInfo
$creadPrec :: ReadPrec BatchGetAssetPropertyValueHistoryErrorInfo
readList :: ReadS [BatchGetAssetPropertyValueHistoryErrorInfo]
$creadList :: ReadS [BatchGetAssetPropertyValueHistoryErrorInfo]
readsPrec :: Int -> ReadS BatchGetAssetPropertyValueHistoryErrorInfo
$creadsPrec :: Int -> ReadS BatchGetAssetPropertyValueHistoryErrorInfo
Prelude.Read, Int -> BatchGetAssetPropertyValueHistoryErrorInfo -> ShowS
[BatchGetAssetPropertyValueHistoryErrorInfo] -> ShowS
BatchGetAssetPropertyValueHistoryErrorInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetAssetPropertyValueHistoryErrorInfo] -> ShowS
$cshowList :: [BatchGetAssetPropertyValueHistoryErrorInfo] -> ShowS
show :: BatchGetAssetPropertyValueHistoryErrorInfo -> String
$cshow :: BatchGetAssetPropertyValueHistoryErrorInfo -> String
showsPrec :: Int -> BatchGetAssetPropertyValueHistoryErrorInfo -> ShowS
$cshowsPrec :: Int -> BatchGetAssetPropertyValueHistoryErrorInfo -> ShowS
Prelude.Show, forall x.
Rep BatchGetAssetPropertyValueHistoryErrorInfo x
-> BatchGetAssetPropertyValueHistoryErrorInfo
forall x.
BatchGetAssetPropertyValueHistoryErrorInfo
-> Rep BatchGetAssetPropertyValueHistoryErrorInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetAssetPropertyValueHistoryErrorInfo x
-> BatchGetAssetPropertyValueHistoryErrorInfo
$cfrom :: forall x.
BatchGetAssetPropertyValueHistoryErrorInfo
-> Rep BatchGetAssetPropertyValueHistoryErrorInfo x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetAssetPropertyValueHistoryErrorInfo' 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:
--
-- 'errorCode', 'batchGetAssetPropertyValueHistoryErrorInfo_errorCode' - The error code.
--
-- 'errorTimestamp', 'batchGetAssetPropertyValueHistoryErrorInfo_errorTimestamp' - The date the error occurred, in Unix epoch time.
newBatchGetAssetPropertyValueHistoryErrorInfo ::
  -- | 'errorCode'
  BatchGetAssetPropertyValueHistoryErrorCode ->
  -- | 'errorTimestamp'
  Prelude.UTCTime ->
  BatchGetAssetPropertyValueHistoryErrorInfo
newBatchGetAssetPropertyValueHistoryErrorInfo :: BatchGetAssetPropertyValueHistoryErrorCode
-> UTCTime -> BatchGetAssetPropertyValueHistoryErrorInfo
newBatchGetAssetPropertyValueHistoryErrorInfo
  BatchGetAssetPropertyValueHistoryErrorCode
pErrorCode_
  UTCTime
pErrorTimestamp_ =
    BatchGetAssetPropertyValueHistoryErrorInfo'
      { $sel:errorCode:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorCode
errorCode =
          BatchGetAssetPropertyValueHistoryErrorCode
pErrorCode_,
        $sel:errorTimestamp:BatchGetAssetPropertyValueHistoryErrorInfo' :: POSIX
errorTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
            forall t b. AReview t b -> b -> t
Lens.# UTCTime
pErrorTimestamp_
      }

-- | The error code.
batchGetAssetPropertyValueHistoryErrorInfo_errorCode :: Lens.Lens' BatchGetAssetPropertyValueHistoryErrorInfo BatchGetAssetPropertyValueHistoryErrorCode
batchGetAssetPropertyValueHistoryErrorInfo_errorCode :: Lens'
  BatchGetAssetPropertyValueHistoryErrorInfo
  BatchGetAssetPropertyValueHistoryErrorCode
batchGetAssetPropertyValueHistoryErrorInfo_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAssetPropertyValueHistoryErrorInfo' {BatchGetAssetPropertyValueHistoryErrorCode
errorCode :: BatchGetAssetPropertyValueHistoryErrorCode
$sel:errorCode:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorCode
errorCode} -> BatchGetAssetPropertyValueHistoryErrorCode
errorCode) (\s :: BatchGetAssetPropertyValueHistoryErrorInfo
s@BatchGetAssetPropertyValueHistoryErrorInfo' {} BatchGetAssetPropertyValueHistoryErrorCode
a -> BatchGetAssetPropertyValueHistoryErrorInfo
s {$sel:errorCode:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorCode
errorCode = BatchGetAssetPropertyValueHistoryErrorCode
a} :: BatchGetAssetPropertyValueHistoryErrorInfo)

-- | The date the error occurred, in Unix epoch time.
batchGetAssetPropertyValueHistoryErrorInfo_errorTimestamp :: Lens.Lens' BatchGetAssetPropertyValueHistoryErrorInfo Prelude.UTCTime
batchGetAssetPropertyValueHistoryErrorInfo_errorTimestamp :: Lens' BatchGetAssetPropertyValueHistoryErrorInfo UTCTime
batchGetAssetPropertyValueHistoryErrorInfo_errorTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAssetPropertyValueHistoryErrorInfo' {POSIX
errorTimestamp :: POSIX
$sel:errorTimestamp:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo -> POSIX
errorTimestamp} -> POSIX
errorTimestamp) (\s :: BatchGetAssetPropertyValueHistoryErrorInfo
s@BatchGetAssetPropertyValueHistoryErrorInfo' {} POSIX
a -> BatchGetAssetPropertyValueHistoryErrorInfo
s {$sel:errorTimestamp:BatchGetAssetPropertyValueHistoryErrorInfo' :: POSIX
errorTimestamp = POSIX
a} :: BatchGetAssetPropertyValueHistoryErrorInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance
  Data.FromJSON
    BatchGetAssetPropertyValueHistoryErrorInfo
  where
  parseJSON :: Value -> Parser BatchGetAssetPropertyValueHistoryErrorInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchGetAssetPropertyValueHistoryErrorInfo"
      ( \Object
x ->
          BatchGetAssetPropertyValueHistoryErrorCode
-> POSIX -> BatchGetAssetPropertyValueHistoryErrorInfo
BatchGetAssetPropertyValueHistoryErrorInfo'
            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
"errorCode")
            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
"errorTimestamp")
      )

instance
  Prelude.Hashable
    BatchGetAssetPropertyValueHistoryErrorInfo
  where
  hashWithSalt :: Int -> BatchGetAssetPropertyValueHistoryErrorInfo -> Int
hashWithSalt
    Int
_salt
    BatchGetAssetPropertyValueHistoryErrorInfo' {POSIX
BatchGetAssetPropertyValueHistoryErrorCode
errorTimestamp :: POSIX
errorCode :: BatchGetAssetPropertyValueHistoryErrorCode
$sel:errorTimestamp:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo -> POSIX
$sel:errorCode:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorCode
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BatchGetAssetPropertyValueHistoryErrorCode
errorCode
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
errorTimestamp

instance
  Prelude.NFData
    BatchGetAssetPropertyValueHistoryErrorInfo
  where
  rnf :: BatchGetAssetPropertyValueHistoryErrorInfo -> ()
rnf BatchGetAssetPropertyValueHistoryErrorInfo' {POSIX
BatchGetAssetPropertyValueHistoryErrorCode
errorTimestamp :: POSIX
errorCode :: BatchGetAssetPropertyValueHistoryErrorCode
$sel:errorTimestamp:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo -> POSIX
$sel:errorCode:BatchGetAssetPropertyValueHistoryErrorInfo' :: BatchGetAssetPropertyValueHistoryErrorInfo
-> BatchGetAssetPropertyValueHistoryErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf BatchGetAssetPropertyValueHistoryErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
errorTimestamp