{-# 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.CompositeModelProperty
-- 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.CompositeModelProperty where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.Property
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a composite model property on an asset.
--
-- /See:/ 'newCompositeModelProperty' smart constructor.
data CompositeModelProperty = CompositeModelProperty'
  { -- | The name of the property.
    CompositeModelProperty -> Text
name :: Prelude.Text,
    -- | The type of the composite model that defines this property.
    CompositeModelProperty -> Text
type' :: Prelude.Text,
    CompositeModelProperty -> Property
assetProperty :: Property
  }
  deriving (CompositeModelProperty -> CompositeModelProperty -> Bool
(CompositeModelProperty -> CompositeModelProperty -> Bool)
-> (CompositeModelProperty -> CompositeModelProperty -> Bool)
-> Eq CompositeModelProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompositeModelProperty -> CompositeModelProperty -> Bool
$c/= :: CompositeModelProperty -> CompositeModelProperty -> Bool
== :: CompositeModelProperty -> CompositeModelProperty -> Bool
$c== :: CompositeModelProperty -> CompositeModelProperty -> Bool
Prelude.Eq, ReadPrec [CompositeModelProperty]
ReadPrec CompositeModelProperty
Int -> ReadS CompositeModelProperty
ReadS [CompositeModelProperty]
(Int -> ReadS CompositeModelProperty)
-> ReadS [CompositeModelProperty]
-> ReadPrec CompositeModelProperty
-> ReadPrec [CompositeModelProperty]
-> Read CompositeModelProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompositeModelProperty]
$creadListPrec :: ReadPrec [CompositeModelProperty]
readPrec :: ReadPrec CompositeModelProperty
$creadPrec :: ReadPrec CompositeModelProperty
readList :: ReadS [CompositeModelProperty]
$creadList :: ReadS [CompositeModelProperty]
readsPrec :: Int -> ReadS CompositeModelProperty
$creadsPrec :: Int -> ReadS CompositeModelProperty
Prelude.Read, Int -> CompositeModelProperty -> ShowS
[CompositeModelProperty] -> ShowS
CompositeModelProperty -> String
(Int -> CompositeModelProperty -> ShowS)
-> (CompositeModelProperty -> String)
-> ([CompositeModelProperty] -> ShowS)
-> Show CompositeModelProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompositeModelProperty] -> ShowS
$cshowList :: [CompositeModelProperty] -> ShowS
show :: CompositeModelProperty -> String
$cshow :: CompositeModelProperty -> String
showsPrec :: Int -> CompositeModelProperty -> ShowS
$cshowsPrec :: Int -> CompositeModelProperty -> ShowS
Prelude.Show, (forall x. CompositeModelProperty -> Rep CompositeModelProperty x)
-> (forall x.
    Rep CompositeModelProperty x -> CompositeModelProperty)
-> Generic CompositeModelProperty
forall x. Rep CompositeModelProperty x -> CompositeModelProperty
forall x. CompositeModelProperty -> Rep CompositeModelProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompositeModelProperty x -> CompositeModelProperty
$cfrom :: forall x. CompositeModelProperty -> Rep CompositeModelProperty x
Prelude.Generic)

-- |
-- Create a value of 'CompositeModelProperty' 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:
--
-- 'name', 'compositeModelProperty_name' - The name of the property.
--
-- 'type'', 'compositeModelProperty_type' - The type of the composite model that defines this property.
--
-- 'assetProperty', 'compositeModelProperty_assetProperty' - Undocumented member.
newCompositeModelProperty ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  -- | 'assetProperty'
  Property ->
  CompositeModelProperty
newCompositeModelProperty :: Text -> Text -> Property -> CompositeModelProperty
newCompositeModelProperty
  Text
pName_
  Text
pType_
  Property
pAssetProperty_ =
    CompositeModelProperty' :: Text -> Text -> Property -> CompositeModelProperty
CompositeModelProperty'
      { $sel:name:CompositeModelProperty' :: Text
name = Text
pName_,
        $sel:type':CompositeModelProperty' :: Text
type' = Text
pType_,
        $sel:assetProperty:CompositeModelProperty' :: Property
assetProperty = Property
pAssetProperty_
      }

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

-- | The type of the composite model that defines this property.
compositeModelProperty_type :: Lens.Lens' CompositeModelProperty Prelude.Text
compositeModelProperty_type :: (Text -> f Text)
-> CompositeModelProperty -> f CompositeModelProperty
compositeModelProperty_type = (CompositeModelProperty -> Text)
-> (CompositeModelProperty -> Text -> CompositeModelProperty)
-> Lens CompositeModelProperty CompositeModelProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeModelProperty' {Text
type' :: Text
$sel:type':CompositeModelProperty' :: CompositeModelProperty -> Text
type'} -> Text
type') (\s :: CompositeModelProperty
s@CompositeModelProperty' {} Text
a -> CompositeModelProperty
s {$sel:type':CompositeModelProperty' :: Text
type' = Text
a} :: CompositeModelProperty)

-- | Undocumented member.
compositeModelProperty_assetProperty :: Lens.Lens' CompositeModelProperty Property
compositeModelProperty_assetProperty :: (Property -> f Property)
-> CompositeModelProperty -> f CompositeModelProperty
compositeModelProperty_assetProperty = (CompositeModelProperty -> Property)
-> (CompositeModelProperty -> Property -> CompositeModelProperty)
-> Lens
     CompositeModelProperty CompositeModelProperty Property Property
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeModelProperty' {Property
assetProperty :: Property
$sel:assetProperty:CompositeModelProperty' :: CompositeModelProperty -> Property
assetProperty} -> Property
assetProperty) (\s :: CompositeModelProperty
s@CompositeModelProperty' {} Property
a -> CompositeModelProperty
s {$sel:assetProperty:CompositeModelProperty' :: Property
assetProperty = Property
a} :: CompositeModelProperty)

instance Core.FromJSON CompositeModelProperty where
  parseJSON :: Value -> Parser CompositeModelProperty
parseJSON =
    String
-> (Object -> Parser CompositeModelProperty)
-> Value
-> Parser CompositeModelProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CompositeModelProperty"
      ( \Object
x ->
          Text -> Text -> Property -> CompositeModelProperty
CompositeModelProperty'
            (Text -> Text -> Property -> CompositeModelProperty)
-> Parser Text
-> Parser (Text -> Property -> CompositeModelProperty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (Text -> Property -> CompositeModelProperty)
-> Parser Text -> Parser (Property -> CompositeModelProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
            Parser (Property -> CompositeModelProperty)
-> Parser Property -> Parser CompositeModelProperty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Property
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"assetProperty")
      )

instance Prelude.Hashable CompositeModelProperty

instance Prelude.NFData CompositeModelProperty