{-# 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.BatchPutAssetPropertyError
-- 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.BatchPutAssetPropertyError 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.BatchPutAssetPropertyValueErrorCode
import Amazonka.IoTSiteWise.Types.TimeInNanos
import qualified Amazonka.Prelude as Prelude

-- | Contains error information from updating a batch of asset property
-- values.
--
-- /See:/ 'newBatchPutAssetPropertyError' smart constructor.
data BatchPutAssetPropertyError = BatchPutAssetPropertyError'
  { -- | The error code.
    BatchPutAssetPropertyError -> BatchPutAssetPropertyValueErrorCode
errorCode :: BatchPutAssetPropertyValueErrorCode,
    -- | The associated error message.
    BatchPutAssetPropertyError -> Text
errorMessage :: Prelude.Text,
    -- | A list of timestamps for each error, if any.
    BatchPutAssetPropertyError -> [TimeInNanos]
timestamps :: [TimeInNanos]
  }
  deriving (BatchPutAssetPropertyError -> BatchPutAssetPropertyError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutAssetPropertyError -> BatchPutAssetPropertyError -> Bool
$c/= :: BatchPutAssetPropertyError -> BatchPutAssetPropertyError -> Bool
== :: BatchPutAssetPropertyError -> BatchPutAssetPropertyError -> Bool
$c== :: BatchPutAssetPropertyError -> BatchPutAssetPropertyError -> Bool
Prelude.Eq, ReadPrec [BatchPutAssetPropertyError]
ReadPrec BatchPutAssetPropertyError
Int -> ReadS BatchPutAssetPropertyError
ReadS [BatchPutAssetPropertyError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPutAssetPropertyError]
$creadListPrec :: ReadPrec [BatchPutAssetPropertyError]
readPrec :: ReadPrec BatchPutAssetPropertyError
$creadPrec :: ReadPrec BatchPutAssetPropertyError
readList :: ReadS [BatchPutAssetPropertyError]
$creadList :: ReadS [BatchPutAssetPropertyError]
readsPrec :: Int -> ReadS BatchPutAssetPropertyError
$creadsPrec :: Int -> ReadS BatchPutAssetPropertyError
Prelude.Read, Int -> BatchPutAssetPropertyError -> ShowS
[BatchPutAssetPropertyError] -> ShowS
BatchPutAssetPropertyError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutAssetPropertyError] -> ShowS
$cshowList :: [BatchPutAssetPropertyError] -> ShowS
show :: BatchPutAssetPropertyError -> String
$cshow :: BatchPutAssetPropertyError -> String
showsPrec :: Int -> BatchPutAssetPropertyError -> ShowS
$cshowsPrec :: Int -> BatchPutAssetPropertyError -> ShowS
Prelude.Show, forall x.
Rep BatchPutAssetPropertyError x -> BatchPutAssetPropertyError
forall x.
BatchPutAssetPropertyError -> Rep BatchPutAssetPropertyError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPutAssetPropertyError x -> BatchPutAssetPropertyError
$cfrom :: forall x.
BatchPutAssetPropertyError -> Rep BatchPutAssetPropertyError x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutAssetPropertyError' 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', 'batchPutAssetPropertyError_errorCode' - The error code.
--
-- 'errorMessage', 'batchPutAssetPropertyError_errorMessage' - The associated error message.
--
-- 'timestamps', 'batchPutAssetPropertyError_timestamps' - A list of timestamps for each error, if any.
newBatchPutAssetPropertyError ::
  -- | 'errorCode'
  BatchPutAssetPropertyValueErrorCode ->
  -- | 'errorMessage'
  Prelude.Text ->
  BatchPutAssetPropertyError
newBatchPutAssetPropertyError :: BatchPutAssetPropertyValueErrorCode
-> Text -> BatchPutAssetPropertyError
newBatchPutAssetPropertyError
  BatchPutAssetPropertyValueErrorCode
pErrorCode_
  Text
pErrorMessage_ =
    BatchPutAssetPropertyError'
      { $sel:errorCode:BatchPutAssetPropertyError' :: BatchPutAssetPropertyValueErrorCode
errorCode =
          BatchPutAssetPropertyValueErrorCode
pErrorCode_,
        $sel:errorMessage:BatchPutAssetPropertyError' :: Text
errorMessage = Text
pErrorMessage_,
        $sel:timestamps:BatchPutAssetPropertyError' :: [TimeInNanos]
timestamps = forall a. Monoid a => a
Prelude.mempty
      }

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

-- | The associated error message.
batchPutAssetPropertyError_errorMessage :: Lens.Lens' BatchPutAssetPropertyError Prelude.Text
batchPutAssetPropertyError_errorMessage :: Lens' BatchPutAssetPropertyError Text
batchPutAssetPropertyError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutAssetPropertyError' {Text
errorMessage :: Text
$sel:errorMessage:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> Text
errorMessage} -> Text
errorMessage) (\s :: BatchPutAssetPropertyError
s@BatchPutAssetPropertyError' {} Text
a -> BatchPutAssetPropertyError
s {$sel:errorMessage:BatchPutAssetPropertyError' :: Text
errorMessage = Text
a} :: BatchPutAssetPropertyError)

-- | A list of timestamps for each error, if any.
batchPutAssetPropertyError_timestamps :: Lens.Lens' BatchPutAssetPropertyError [TimeInNanos]
batchPutAssetPropertyError_timestamps :: Lens' BatchPutAssetPropertyError [TimeInNanos]
batchPutAssetPropertyError_timestamps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutAssetPropertyError' {[TimeInNanos]
timestamps :: [TimeInNanos]
$sel:timestamps:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> [TimeInNanos]
timestamps} -> [TimeInNanos]
timestamps) (\s :: BatchPutAssetPropertyError
s@BatchPutAssetPropertyError' {} [TimeInNanos]
a -> BatchPutAssetPropertyError
s {$sel:timestamps:BatchPutAssetPropertyError' :: [TimeInNanos]
timestamps = [TimeInNanos]
a} :: BatchPutAssetPropertyError) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON BatchPutAssetPropertyError where
  parseJSON :: Value -> Parser BatchPutAssetPropertyError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchPutAssetPropertyError"
      ( \Object
x ->
          BatchPutAssetPropertyValueErrorCode
-> Text -> [TimeInNanos] -> BatchPutAssetPropertyError
BatchPutAssetPropertyError'
            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
"errorMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timestamps" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable BatchPutAssetPropertyError where
  hashWithSalt :: Int -> BatchPutAssetPropertyError -> Int
hashWithSalt Int
_salt BatchPutAssetPropertyError' {[TimeInNanos]
Text
BatchPutAssetPropertyValueErrorCode
timestamps :: [TimeInNanos]
errorMessage :: Text
errorCode :: BatchPutAssetPropertyValueErrorCode
$sel:timestamps:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> [TimeInNanos]
$sel:errorMessage:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> Text
$sel:errorCode:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> BatchPutAssetPropertyValueErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BatchPutAssetPropertyValueErrorCode
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [TimeInNanos]
timestamps

instance Prelude.NFData BatchPutAssetPropertyError where
  rnf :: BatchPutAssetPropertyError -> ()
rnf BatchPutAssetPropertyError' {[TimeInNanos]
Text
BatchPutAssetPropertyValueErrorCode
timestamps :: [TimeInNanos]
errorMessage :: Text
errorCode :: BatchPutAssetPropertyValueErrorCode
$sel:timestamps:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> [TimeInNanos]
$sel:errorMessage:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> Text
$sel:errorCode:BatchPutAssetPropertyError' :: BatchPutAssetPropertyError -> BatchPutAssetPropertyValueErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf BatchPutAssetPropertyValueErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [TimeInNanos]
timestamps