{-# 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.BatchGetAssetPropertyAggregatesSuccessEntry
-- 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.BatchGetAssetPropertyAggregatesSuccessEntry 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.AggregatedValue
import qualified Amazonka.Prelude as Prelude

-- | Contains success information for an entry that is associated with the
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyAggregates.html BatchGetAssetPropertyAggregates>
-- API.
--
-- /See:/ 'newBatchGetAssetPropertyAggregatesSuccessEntry' smart constructor.
data BatchGetAssetPropertyAggregatesSuccessEntry = BatchGetAssetPropertyAggregatesSuccessEntry'
  { -- | The ID of the entry.
    BatchGetAssetPropertyAggregatesSuccessEntry -> Text
entryId :: Prelude.Text,
    -- | The requested aggregated asset property values (for example, average,
    -- minimum, and maximum).
    BatchGetAssetPropertyAggregatesSuccessEntry -> [AggregatedValue]
aggregatedValues :: [AggregatedValue]
  }
  deriving (BatchGetAssetPropertyAggregatesSuccessEntry
-> BatchGetAssetPropertyAggregatesSuccessEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetAssetPropertyAggregatesSuccessEntry
-> BatchGetAssetPropertyAggregatesSuccessEntry -> Bool
$c/= :: BatchGetAssetPropertyAggregatesSuccessEntry
-> BatchGetAssetPropertyAggregatesSuccessEntry -> Bool
== :: BatchGetAssetPropertyAggregatesSuccessEntry
-> BatchGetAssetPropertyAggregatesSuccessEntry -> Bool
$c== :: BatchGetAssetPropertyAggregatesSuccessEntry
-> BatchGetAssetPropertyAggregatesSuccessEntry -> Bool
Prelude.Eq, ReadPrec [BatchGetAssetPropertyAggregatesSuccessEntry]
ReadPrec BatchGetAssetPropertyAggregatesSuccessEntry
Int -> ReadS BatchGetAssetPropertyAggregatesSuccessEntry
ReadS [BatchGetAssetPropertyAggregatesSuccessEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetAssetPropertyAggregatesSuccessEntry]
$creadListPrec :: ReadPrec [BatchGetAssetPropertyAggregatesSuccessEntry]
readPrec :: ReadPrec BatchGetAssetPropertyAggregatesSuccessEntry
$creadPrec :: ReadPrec BatchGetAssetPropertyAggregatesSuccessEntry
readList :: ReadS [BatchGetAssetPropertyAggregatesSuccessEntry]
$creadList :: ReadS [BatchGetAssetPropertyAggregatesSuccessEntry]
readsPrec :: Int -> ReadS BatchGetAssetPropertyAggregatesSuccessEntry
$creadsPrec :: Int -> ReadS BatchGetAssetPropertyAggregatesSuccessEntry
Prelude.Read, Int -> BatchGetAssetPropertyAggregatesSuccessEntry -> ShowS
[BatchGetAssetPropertyAggregatesSuccessEntry] -> ShowS
BatchGetAssetPropertyAggregatesSuccessEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetAssetPropertyAggregatesSuccessEntry] -> ShowS
$cshowList :: [BatchGetAssetPropertyAggregatesSuccessEntry] -> ShowS
show :: BatchGetAssetPropertyAggregatesSuccessEntry -> String
$cshow :: BatchGetAssetPropertyAggregatesSuccessEntry -> String
showsPrec :: Int -> BatchGetAssetPropertyAggregatesSuccessEntry -> ShowS
$cshowsPrec :: Int -> BatchGetAssetPropertyAggregatesSuccessEntry -> ShowS
Prelude.Show, forall x.
Rep BatchGetAssetPropertyAggregatesSuccessEntry x
-> BatchGetAssetPropertyAggregatesSuccessEntry
forall x.
BatchGetAssetPropertyAggregatesSuccessEntry
-> Rep BatchGetAssetPropertyAggregatesSuccessEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetAssetPropertyAggregatesSuccessEntry x
-> BatchGetAssetPropertyAggregatesSuccessEntry
$cfrom :: forall x.
BatchGetAssetPropertyAggregatesSuccessEntry
-> Rep BatchGetAssetPropertyAggregatesSuccessEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetAssetPropertyAggregatesSuccessEntry' 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:
--
-- 'entryId', 'batchGetAssetPropertyAggregatesSuccessEntry_entryId' - The ID of the entry.
--
-- 'aggregatedValues', 'batchGetAssetPropertyAggregatesSuccessEntry_aggregatedValues' - The requested aggregated asset property values (for example, average,
-- minimum, and maximum).
newBatchGetAssetPropertyAggregatesSuccessEntry ::
  -- | 'entryId'
  Prelude.Text ->
  BatchGetAssetPropertyAggregatesSuccessEntry
newBatchGetAssetPropertyAggregatesSuccessEntry :: Text -> BatchGetAssetPropertyAggregatesSuccessEntry
newBatchGetAssetPropertyAggregatesSuccessEntry
  Text
pEntryId_ =
    BatchGetAssetPropertyAggregatesSuccessEntry'
      { $sel:entryId:BatchGetAssetPropertyAggregatesSuccessEntry' :: Text
entryId =
          Text
pEntryId_,
        $sel:aggregatedValues:BatchGetAssetPropertyAggregatesSuccessEntry' :: [AggregatedValue]
aggregatedValues =
          forall a. Monoid a => a
Prelude.mempty
      }

-- | The ID of the entry.
batchGetAssetPropertyAggregatesSuccessEntry_entryId :: Lens.Lens' BatchGetAssetPropertyAggregatesSuccessEntry Prelude.Text
batchGetAssetPropertyAggregatesSuccessEntry_entryId :: Lens' BatchGetAssetPropertyAggregatesSuccessEntry Text
batchGetAssetPropertyAggregatesSuccessEntry_entryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAssetPropertyAggregatesSuccessEntry' {Text
entryId :: Text
$sel:entryId:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> Text
entryId} -> Text
entryId) (\s :: BatchGetAssetPropertyAggregatesSuccessEntry
s@BatchGetAssetPropertyAggregatesSuccessEntry' {} Text
a -> BatchGetAssetPropertyAggregatesSuccessEntry
s {$sel:entryId:BatchGetAssetPropertyAggregatesSuccessEntry' :: Text
entryId = Text
a} :: BatchGetAssetPropertyAggregatesSuccessEntry)

-- | The requested aggregated asset property values (for example, average,
-- minimum, and maximum).
batchGetAssetPropertyAggregatesSuccessEntry_aggregatedValues :: Lens.Lens' BatchGetAssetPropertyAggregatesSuccessEntry [AggregatedValue]
batchGetAssetPropertyAggregatesSuccessEntry_aggregatedValues :: Lens' BatchGetAssetPropertyAggregatesSuccessEntry [AggregatedValue]
batchGetAssetPropertyAggregatesSuccessEntry_aggregatedValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAssetPropertyAggregatesSuccessEntry' {[AggregatedValue]
aggregatedValues :: [AggregatedValue]
$sel:aggregatedValues:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> [AggregatedValue]
aggregatedValues} -> [AggregatedValue]
aggregatedValues) (\s :: BatchGetAssetPropertyAggregatesSuccessEntry
s@BatchGetAssetPropertyAggregatesSuccessEntry' {} [AggregatedValue]
a -> BatchGetAssetPropertyAggregatesSuccessEntry
s {$sel:aggregatedValues:BatchGetAssetPropertyAggregatesSuccessEntry' :: [AggregatedValue]
aggregatedValues = [AggregatedValue]
a} :: BatchGetAssetPropertyAggregatesSuccessEntry) 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
    BatchGetAssetPropertyAggregatesSuccessEntry
  where
  parseJSON :: Value -> Parser BatchGetAssetPropertyAggregatesSuccessEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchGetAssetPropertyAggregatesSuccessEntry"
      ( \Object
x ->
          Text
-> [AggregatedValue] -> BatchGetAssetPropertyAggregatesSuccessEntry
BatchGetAssetPropertyAggregatesSuccessEntry'
            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
"entryId")
            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
"aggregatedValues"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    BatchGetAssetPropertyAggregatesSuccessEntry
  where
  hashWithSalt :: Int -> BatchGetAssetPropertyAggregatesSuccessEntry -> Int
hashWithSalt
    Int
_salt
    BatchGetAssetPropertyAggregatesSuccessEntry' {[AggregatedValue]
Text
aggregatedValues :: [AggregatedValue]
entryId :: Text
$sel:aggregatedValues:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> [AggregatedValue]
$sel:entryId:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
entryId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [AggregatedValue]
aggregatedValues

instance
  Prelude.NFData
    BatchGetAssetPropertyAggregatesSuccessEntry
  where
  rnf :: BatchGetAssetPropertyAggregatesSuccessEntry -> ()
rnf BatchGetAssetPropertyAggregatesSuccessEntry' {[AggregatedValue]
Text
aggregatedValues :: [AggregatedValue]
entryId :: Text
$sel:aggregatedValues:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> [AggregatedValue]
$sel:entryId:BatchGetAssetPropertyAggregatesSuccessEntry' :: BatchGetAssetPropertyAggregatesSuccessEntry -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
entryId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AggregatedValue]
aggregatedValues