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

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.TimeInNanos
import Amazonka.IoTSiteWise.Types.Variant
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an interpolated asset property value.
--
-- /See:/ 'newInterpolatedAssetPropertyValue' smart constructor.
data InterpolatedAssetPropertyValue = InterpolatedAssetPropertyValue'
  { InterpolatedAssetPropertyValue -> TimeInNanos
timestamp :: TimeInNanos,
    InterpolatedAssetPropertyValue -> Variant
value :: Variant
  }
  deriving (InterpolatedAssetPropertyValue
-> InterpolatedAssetPropertyValue -> Bool
(InterpolatedAssetPropertyValue
 -> InterpolatedAssetPropertyValue -> Bool)
-> (InterpolatedAssetPropertyValue
    -> InterpolatedAssetPropertyValue -> Bool)
-> Eq InterpolatedAssetPropertyValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InterpolatedAssetPropertyValue
-> InterpolatedAssetPropertyValue -> Bool
$c/= :: InterpolatedAssetPropertyValue
-> InterpolatedAssetPropertyValue -> Bool
== :: InterpolatedAssetPropertyValue
-> InterpolatedAssetPropertyValue -> Bool
$c== :: InterpolatedAssetPropertyValue
-> InterpolatedAssetPropertyValue -> Bool
Prelude.Eq, ReadPrec [InterpolatedAssetPropertyValue]
ReadPrec InterpolatedAssetPropertyValue
Int -> ReadS InterpolatedAssetPropertyValue
ReadS [InterpolatedAssetPropertyValue]
(Int -> ReadS InterpolatedAssetPropertyValue)
-> ReadS [InterpolatedAssetPropertyValue]
-> ReadPrec InterpolatedAssetPropertyValue
-> ReadPrec [InterpolatedAssetPropertyValue]
-> Read InterpolatedAssetPropertyValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InterpolatedAssetPropertyValue]
$creadListPrec :: ReadPrec [InterpolatedAssetPropertyValue]
readPrec :: ReadPrec InterpolatedAssetPropertyValue
$creadPrec :: ReadPrec InterpolatedAssetPropertyValue
readList :: ReadS [InterpolatedAssetPropertyValue]
$creadList :: ReadS [InterpolatedAssetPropertyValue]
readsPrec :: Int -> ReadS InterpolatedAssetPropertyValue
$creadsPrec :: Int -> ReadS InterpolatedAssetPropertyValue
Prelude.Read, Int -> InterpolatedAssetPropertyValue -> ShowS
[InterpolatedAssetPropertyValue] -> ShowS
InterpolatedAssetPropertyValue -> String
(Int -> InterpolatedAssetPropertyValue -> ShowS)
-> (InterpolatedAssetPropertyValue -> String)
-> ([InterpolatedAssetPropertyValue] -> ShowS)
-> Show InterpolatedAssetPropertyValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InterpolatedAssetPropertyValue] -> ShowS
$cshowList :: [InterpolatedAssetPropertyValue] -> ShowS
show :: InterpolatedAssetPropertyValue -> String
$cshow :: InterpolatedAssetPropertyValue -> String
showsPrec :: Int -> InterpolatedAssetPropertyValue -> ShowS
$cshowsPrec :: Int -> InterpolatedAssetPropertyValue -> ShowS
Prelude.Show, (forall x.
 InterpolatedAssetPropertyValue
 -> Rep InterpolatedAssetPropertyValue x)
-> (forall x.
    Rep InterpolatedAssetPropertyValue x
    -> InterpolatedAssetPropertyValue)
-> Generic InterpolatedAssetPropertyValue
forall x.
Rep InterpolatedAssetPropertyValue x
-> InterpolatedAssetPropertyValue
forall x.
InterpolatedAssetPropertyValue
-> Rep InterpolatedAssetPropertyValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InterpolatedAssetPropertyValue x
-> InterpolatedAssetPropertyValue
$cfrom :: forall x.
InterpolatedAssetPropertyValue
-> Rep InterpolatedAssetPropertyValue x
Prelude.Generic)

-- |
-- Create a value of 'InterpolatedAssetPropertyValue' 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:
--
-- 'timestamp', 'interpolatedAssetPropertyValue_timestamp' - Undocumented member.
--
-- 'value', 'interpolatedAssetPropertyValue_value' - Undocumented member.
newInterpolatedAssetPropertyValue ::
  -- | 'timestamp'
  TimeInNanos ->
  -- | 'value'
  Variant ->
  InterpolatedAssetPropertyValue
newInterpolatedAssetPropertyValue :: TimeInNanos -> Variant -> InterpolatedAssetPropertyValue
newInterpolatedAssetPropertyValue TimeInNanos
pTimestamp_ Variant
pValue_ =
  InterpolatedAssetPropertyValue' :: TimeInNanos -> Variant -> InterpolatedAssetPropertyValue
InterpolatedAssetPropertyValue'
    { $sel:timestamp:InterpolatedAssetPropertyValue' :: TimeInNanos
timestamp =
        TimeInNanos
pTimestamp_,
      $sel:value:InterpolatedAssetPropertyValue' :: Variant
value = Variant
pValue_
    }

-- | Undocumented member.
interpolatedAssetPropertyValue_timestamp :: Lens.Lens' InterpolatedAssetPropertyValue TimeInNanos
interpolatedAssetPropertyValue_timestamp :: (TimeInNanos -> f TimeInNanos)
-> InterpolatedAssetPropertyValue
-> f InterpolatedAssetPropertyValue
interpolatedAssetPropertyValue_timestamp = (InterpolatedAssetPropertyValue -> TimeInNanos)
-> (InterpolatedAssetPropertyValue
    -> TimeInNanos -> InterpolatedAssetPropertyValue)
-> Lens
     InterpolatedAssetPropertyValue
     InterpolatedAssetPropertyValue
     TimeInNanos
     TimeInNanos
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InterpolatedAssetPropertyValue' {TimeInNanos
timestamp :: TimeInNanos
$sel:timestamp:InterpolatedAssetPropertyValue' :: InterpolatedAssetPropertyValue -> TimeInNanos
timestamp} -> TimeInNanos
timestamp) (\s :: InterpolatedAssetPropertyValue
s@InterpolatedAssetPropertyValue' {} TimeInNanos
a -> InterpolatedAssetPropertyValue
s {$sel:timestamp:InterpolatedAssetPropertyValue' :: TimeInNanos
timestamp = TimeInNanos
a} :: InterpolatedAssetPropertyValue)

-- | Undocumented member.
interpolatedAssetPropertyValue_value :: Lens.Lens' InterpolatedAssetPropertyValue Variant
interpolatedAssetPropertyValue_value :: (Variant -> f Variant)
-> InterpolatedAssetPropertyValue
-> f InterpolatedAssetPropertyValue
interpolatedAssetPropertyValue_value = (InterpolatedAssetPropertyValue -> Variant)
-> (InterpolatedAssetPropertyValue
    -> Variant -> InterpolatedAssetPropertyValue)
-> Lens
     InterpolatedAssetPropertyValue
     InterpolatedAssetPropertyValue
     Variant
     Variant
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InterpolatedAssetPropertyValue' {Variant
value :: Variant
$sel:value:InterpolatedAssetPropertyValue' :: InterpolatedAssetPropertyValue -> Variant
value} -> Variant
value) (\s :: InterpolatedAssetPropertyValue
s@InterpolatedAssetPropertyValue' {} Variant
a -> InterpolatedAssetPropertyValue
s {$sel:value:InterpolatedAssetPropertyValue' :: Variant
value = Variant
a} :: InterpolatedAssetPropertyValue)

instance Core.FromJSON InterpolatedAssetPropertyValue where
  parseJSON :: Value -> Parser InterpolatedAssetPropertyValue
parseJSON =
    String
-> (Object -> Parser InterpolatedAssetPropertyValue)
-> Value
-> Parser InterpolatedAssetPropertyValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InterpolatedAssetPropertyValue"
      ( \Object
x ->
          TimeInNanos -> Variant -> InterpolatedAssetPropertyValue
InterpolatedAssetPropertyValue'
            (TimeInNanos -> Variant -> InterpolatedAssetPropertyValue)
-> Parser TimeInNanos
-> Parser (Variant -> InterpolatedAssetPropertyValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser TimeInNanos
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timestamp")
            Parser (Variant -> InterpolatedAssetPropertyValue)
-> Parser Variant -> Parser InterpolatedAssetPropertyValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Variant
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"value")
      )

instance
  Prelude.Hashable
    InterpolatedAssetPropertyValue

instance
  Prelude.NFData
    InterpolatedAssetPropertyValue