{-# 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.AssetProperty
-- 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.AssetProperty 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.PropertyDataType
import Amazonka.IoTSiteWise.Types.PropertyNotification
import qualified Amazonka.Prelude as Prelude

-- | Contains asset property information.
--
-- /See:/ 'newAssetProperty' smart constructor.
data AssetProperty = AssetProperty'
  { -- | The alias that identifies the property, such as an OPC-UA server data
    -- stream path (for example,
    -- @\/company\/windfarm\/3\/turbine\/7\/temperature@). For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html Mapping industrial data streams to asset properties>
    -- in the /IoT SiteWise User Guide/.
    AssetProperty -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
    -- | The data type of the structure for this property. This parameter exists
    -- on properties that have the @STRUCT@ data type.
    AssetProperty -> Maybe Text
dataTypeSpec :: Prelude.Maybe Prelude.Text,
    -- | The asset property\'s notification topic and state. For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html UpdateAssetProperty>.
    AssetProperty -> Maybe PropertyNotification
notification :: Prelude.Maybe PropertyNotification,
    -- | The unit (such as @Newtons@ or @RPM@) of the asset property.
    AssetProperty -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
    -- | The ID of the asset property.
    AssetProperty -> Text
id :: Prelude.Text,
    -- | The name of the property.
    AssetProperty -> Text
name :: Prelude.Text,
    -- | The data type of the asset property.
    AssetProperty -> PropertyDataType
dataType :: PropertyDataType
  }
  deriving (AssetProperty -> AssetProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetProperty -> AssetProperty -> Bool
$c/= :: AssetProperty -> AssetProperty -> Bool
== :: AssetProperty -> AssetProperty -> Bool
$c== :: AssetProperty -> AssetProperty -> Bool
Prelude.Eq, ReadPrec [AssetProperty]
ReadPrec AssetProperty
Int -> ReadS AssetProperty
ReadS [AssetProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetProperty]
$creadListPrec :: ReadPrec [AssetProperty]
readPrec :: ReadPrec AssetProperty
$creadPrec :: ReadPrec AssetProperty
readList :: ReadS [AssetProperty]
$creadList :: ReadS [AssetProperty]
readsPrec :: Int -> ReadS AssetProperty
$creadsPrec :: Int -> ReadS AssetProperty
Prelude.Read, Int -> AssetProperty -> ShowS
[AssetProperty] -> ShowS
AssetProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetProperty] -> ShowS
$cshowList :: [AssetProperty] -> ShowS
show :: AssetProperty -> String
$cshow :: AssetProperty -> String
showsPrec :: Int -> AssetProperty -> ShowS
$cshowsPrec :: Int -> AssetProperty -> ShowS
Prelude.Show, forall x. Rep AssetProperty x -> AssetProperty
forall x. AssetProperty -> Rep AssetProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetProperty x -> AssetProperty
$cfrom :: forall x. AssetProperty -> Rep AssetProperty x
Prelude.Generic)

-- |
-- Create a value of 'AssetProperty' 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:
--
-- 'alias', 'assetProperty_alias' - The alias that identifies the property, such as an OPC-UA server data
-- stream path (for example,
-- @\/company\/windfarm\/3\/turbine\/7\/temperature@). For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html Mapping industrial data streams to asset properties>
-- in the /IoT SiteWise User Guide/.
--
-- 'dataTypeSpec', 'assetProperty_dataTypeSpec' - The data type of the structure for this property. This parameter exists
-- on properties that have the @STRUCT@ data type.
--
-- 'notification', 'assetProperty_notification' - The asset property\'s notification topic and state. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html UpdateAssetProperty>.
--
-- 'unit', 'assetProperty_unit' - The unit (such as @Newtons@ or @RPM@) of the asset property.
--
-- 'id', 'assetProperty_id' - The ID of the asset property.
--
-- 'name', 'assetProperty_name' - The name of the property.
--
-- 'dataType', 'assetProperty_dataType' - The data type of the asset property.
newAssetProperty ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'dataType'
  PropertyDataType ->
  AssetProperty
newAssetProperty :: Text -> Text -> PropertyDataType -> AssetProperty
newAssetProperty Text
pId_ Text
pName_ PropertyDataType
pDataType_ =
  AssetProperty'
    { $sel:alias:AssetProperty' :: Maybe Text
alias = forall a. Maybe a
Prelude.Nothing,
      $sel:dataTypeSpec:AssetProperty' :: Maybe Text
dataTypeSpec = forall a. Maybe a
Prelude.Nothing,
      $sel:notification:AssetProperty' :: Maybe PropertyNotification
notification = forall a. Maybe a
Prelude.Nothing,
      $sel:unit:AssetProperty' :: Maybe Text
unit = forall a. Maybe a
Prelude.Nothing,
      $sel:id:AssetProperty' :: Text
id = Text
pId_,
      $sel:name:AssetProperty' :: Text
name = Text
pName_,
      $sel:dataType:AssetProperty' :: PropertyDataType
dataType = PropertyDataType
pDataType_
    }

-- | The alias that identifies the property, such as an OPC-UA server data
-- stream path (for example,
-- @\/company\/windfarm\/3\/turbine\/7\/temperature@). For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html Mapping industrial data streams to asset properties>
-- in the /IoT SiteWise User Guide/.
assetProperty_alias :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_alias :: Lens' AssetProperty (Maybe Text)
assetProperty_alias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
alias :: Maybe Text
$sel:alias:AssetProperty' :: AssetProperty -> Maybe Text
alias} -> Maybe Text
alias) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:alias:AssetProperty' :: Maybe Text
alias = Maybe Text
a} :: AssetProperty)

-- | The data type of the structure for this property. This parameter exists
-- on properties that have the @STRUCT@ data type.
assetProperty_dataTypeSpec :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_dataTypeSpec :: Lens' AssetProperty (Maybe Text)
assetProperty_dataTypeSpec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
dataTypeSpec :: Maybe Text
$sel:dataTypeSpec:AssetProperty' :: AssetProperty -> Maybe Text
dataTypeSpec} -> Maybe Text
dataTypeSpec) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:dataTypeSpec:AssetProperty' :: Maybe Text
dataTypeSpec = Maybe Text
a} :: AssetProperty)

-- | The asset property\'s notification topic and state. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html UpdateAssetProperty>.
assetProperty_notification :: Lens.Lens' AssetProperty (Prelude.Maybe PropertyNotification)
assetProperty_notification :: Lens' AssetProperty (Maybe PropertyNotification)
assetProperty_notification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe PropertyNotification
notification :: Maybe PropertyNotification
$sel:notification:AssetProperty' :: AssetProperty -> Maybe PropertyNotification
notification} -> Maybe PropertyNotification
notification) (\s :: AssetProperty
s@AssetProperty' {} Maybe PropertyNotification
a -> AssetProperty
s {$sel:notification:AssetProperty' :: Maybe PropertyNotification
notification = Maybe PropertyNotification
a} :: AssetProperty)

-- | The unit (such as @Newtons@ or @RPM@) of the asset property.
assetProperty_unit :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_unit :: Lens' AssetProperty (Maybe Text)
assetProperty_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
unit :: Maybe Text
$sel:unit:AssetProperty' :: AssetProperty -> Maybe Text
unit} -> Maybe Text
unit) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:unit:AssetProperty' :: Maybe Text
unit = Maybe Text
a} :: AssetProperty)

-- | The ID of the asset property.
assetProperty_id :: Lens.Lens' AssetProperty Prelude.Text
assetProperty_id :: Lens' AssetProperty Text
assetProperty_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Text
id :: Text
$sel:id:AssetProperty' :: AssetProperty -> Text
id} -> Text
id) (\s :: AssetProperty
s@AssetProperty' {} Text
a -> AssetProperty
s {$sel:id:AssetProperty' :: Text
id = Text
a} :: AssetProperty)

-- | The name of the property.
assetProperty_name :: Lens.Lens' AssetProperty Prelude.Text
assetProperty_name :: Lens' AssetProperty Text
assetProperty_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Text
name :: Text
$sel:name:AssetProperty' :: AssetProperty -> Text
name} -> Text
name) (\s :: AssetProperty
s@AssetProperty' {} Text
a -> AssetProperty
s {$sel:name:AssetProperty' :: Text
name = Text
a} :: AssetProperty)

-- | The data type of the asset property.
assetProperty_dataType :: Lens.Lens' AssetProperty PropertyDataType
assetProperty_dataType :: Lens' AssetProperty PropertyDataType
assetProperty_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {PropertyDataType
dataType :: PropertyDataType
$sel:dataType:AssetProperty' :: AssetProperty -> PropertyDataType
dataType} -> PropertyDataType
dataType) (\s :: AssetProperty
s@AssetProperty' {} PropertyDataType
a -> AssetProperty
s {$sel:dataType:AssetProperty' :: PropertyDataType
dataType = PropertyDataType
a} :: AssetProperty)

instance Data.FromJSON AssetProperty where
  parseJSON :: Value -> Parser AssetProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AssetProperty"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe PropertyNotification
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty
AssetProperty'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"alias")
            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
"dataTypeSpec")
            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
"notification")
            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
"unit")
            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
"id")
            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
"name")
            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
"dataType")
      )

instance Prelude.Hashable AssetProperty where
  hashWithSalt :: Int -> AssetProperty -> Int
hashWithSalt Int
_salt AssetProperty' {Maybe Text
Maybe PropertyNotification
Text
PropertyDataType
dataType :: PropertyDataType
name :: Text
id :: Text
unit :: Maybe Text
notification :: Maybe PropertyNotification
dataTypeSpec :: Maybe Text
alias :: Maybe Text
$sel:dataType:AssetProperty' :: AssetProperty -> PropertyDataType
$sel:name:AssetProperty' :: AssetProperty -> Text
$sel:id:AssetProperty' :: AssetProperty -> Text
$sel:unit:AssetProperty' :: AssetProperty -> Maybe Text
$sel:notification:AssetProperty' :: AssetProperty -> Maybe PropertyNotification
$sel:dataTypeSpec:AssetProperty' :: AssetProperty -> Maybe Text
$sel:alias:AssetProperty' :: AssetProperty -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
alias
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataTypeSpec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PropertyNotification
notification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PropertyDataType
dataType

instance Prelude.NFData AssetProperty where
  rnf :: AssetProperty -> ()
rnf AssetProperty' {Maybe Text
Maybe PropertyNotification
Text
PropertyDataType
dataType :: PropertyDataType
name :: Text
id :: Text
unit :: Maybe Text
notification :: Maybe PropertyNotification
dataTypeSpec :: Maybe Text
alias :: Maybe Text
$sel:dataType:AssetProperty' :: AssetProperty -> PropertyDataType
$sel:name:AssetProperty' :: AssetProperty -> Text
$sel:id:AssetProperty' :: AssetProperty -> Text
$sel:unit:AssetProperty' :: AssetProperty -> Maybe Text
$sel:notification:AssetProperty' :: AssetProperty -> Maybe PropertyNotification
$sel:dataTypeSpec:AssetProperty' :: AssetProperty -> Maybe Text
$sel:alias:AssetProperty' :: AssetProperty -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
alias
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataTypeSpec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PropertyNotification
notification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PropertyDataType
dataType