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

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

-- | Contains a summary of an asset model.
--
-- /See:/ 'newAssetModelSummary' smart constructor.
data AssetModelSummary = AssetModelSummary'
  { -- | The ID of the asset model (used with IoT SiteWise APIs).
    AssetModelSummary -> Text
id :: Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the asset model, which has the following format.
    --
    -- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model\/${AssetModelId}@
    AssetModelSummary -> Text
arn :: Prelude.Text,
    -- | The name of the asset model.
    AssetModelSummary -> Text
name :: Prelude.Text,
    -- | The asset model description.
    AssetModelSummary -> Text
description :: Prelude.Text,
    -- | The date the asset model was created, in Unix epoch time.
    AssetModelSummary -> POSIX
creationDate :: Core.POSIX,
    -- | The date the asset model was last updated, in Unix epoch time.
    AssetModelSummary -> POSIX
lastUpdateDate :: Core.POSIX,
    -- | The current status of the asset model.
    AssetModelSummary -> AssetModelStatus
status :: AssetModelStatus
  }
  deriving (AssetModelSummary -> AssetModelSummary -> Bool
(AssetModelSummary -> AssetModelSummary -> Bool)
-> (AssetModelSummary -> AssetModelSummary -> Bool)
-> Eq AssetModelSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetModelSummary -> AssetModelSummary -> Bool
$c/= :: AssetModelSummary -> AssetModelSummary -> Bool
== :: AssetModelSummary -> AssetModelSummary -> Bool
$c== :: AssetModelSummary -> AssetModelSummary -> Bool
Prelude.Eq, ReadPrec [AssetModelSummary]
ReadPrec AssetModelSummary
Int -> ReadS AssetModelSummary
ReadS [AssetModelSummary]
(Int -> ReadS AssetModelSummary)
-> ReadS [AssetModelSummary]
-> ReadPrec AssetModelSummary
-> ReadPrec [AssetModelSummary]
-> Read AssetModelSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetModelSummary]
$creadListPrec :: ReadPrec [AssetModelSummary]
readPrec :: ReadPrec AssetModelSummary
$creadPrec :: ReadPrec AssetModelSummary
readList :: ReadS [AssetModelSummary]
$creadList :: ReadS [AssetModelSummary]
readsPrec :: Int -> ReadS AssetModelSummary
$creadsPrec :: Int -> ReadS AssetModelSummary
Prelude.Read, Int -> AssetModelSummary -> ShowS
[AssetModelSummary] -> ShowS
AssetModelSummary -> String
(Int -> AssetModelSummary -> ShowS)
-> (AssetModelSummary -> String)
-> ([AssetModelSummary] -> ShowS)
-> Show AssetModelSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetModelSummary] -> ShowS
$cshowList :: [AssetModelSummary] -> ShowS
show :: AssetModelSummary -> String
$cshow :: AssetModelSummary -> String
showsPrec :: Int -> AssetModelSummary -> ShowS
$cshowsPrec :: Int -> AssetModelSummary -> ShowS
Prelude.Show, (forall x. AssetModelSummary -> Rep AssetModelSummary x)
-> (forall x. Rep AssetModelSummary x -> AssetModelSummary)
-> Generic AssetModelSummary
forall x. Rep AssetModelSummary x -> AssetModelSummary
forall x. AssetModelSummary -> Rep AssetModelSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetModelSummary x -> AssetModelSummary
$cfrom :: forall x. AssetModelSummary -> Rep AssetModelSummary x
Prelude.Generic)

-- |
-- Create a value of 'AssetModelSummary' 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:
--
-- 'id', 'assetModelSummary_id' - The ID of the asset model (used with IoT SiteWise APIs).
--
-- 'arn', 'assetModelSummary_arn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the asset model, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model\/${AssetModelId}@
--
-- 'name', 'assetModelSummary_name' - The name of the asset model.
--
-- 'description', 'assetModelSummary_description' - The asset model description.
--
-- 'creationDate', 'assetModelSummary_creationDate' - The date the asset model was created, in Unix epoch time.
--
-- 'lastUpdateDate', 'assetModelSummary_lastUpdateDate' - The date the asset model was last updated, in Unix epoch time.
--
-- 'status', 'assetModelSummary_status' - The current status of the asset model.
newAssetModelSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'description'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'lastUpdateDate'
  Prelude.UTCTime ->
  -- | 'status'
  AssetModelStatus ->
  AssetModelSummary
newAssetModelSummary :: Text
-> Text
-> Text
-> Text
-> UTCTime
-> UTCTime
-> AssetModelStatus
-> AssetModelSummary
newAssetModelSummary
  Text
pId_
  Text
pArn_
  Text
pName_
  Text
pDescription_
  UTCTime
pCreationDate_
  UTCTime
pLastUpdateDate_
  AssetModelStatus
pStatus_ =
    AssetModelSummary' :: Text
-> Text
-> Text
-> Text
-> POSIX
-> POSIX
-> AssetModelStatus
-> AssetModelSummary
AssetModelSummary'
      { $sel:id:AssetModelSummary' :: Text
id = Text
pId_,
        $sel:arn:AssetModelSummary' :: Text
arn = Text
pArn_,
        $sel:name:AssetModelSummary' :: Text
name = Text
pName_,
        $sel:description:AssetModelSummary' :: Text
description = Text
pDescription_,
        $sel:creationDate:AssetModelSummary' :: POSIX
creationDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
        $sel:lastUpdateDate:AssetModelSummary' :: POSIX
lastUpdateDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateDate_,
        $sel:status:AssetModelSummary' :: AssetModelStatus
status = AssetModelStatus
pStatus_
      }

-- | The ID of the asset model (used with IoT SiteWise APIs).
assetModelSummary_id :: Lens.Lens' AssetModelSummary Prelude.Text
assetModelSummary_id :: (Text -> f Text) -> AssetModelSummary -> f AssetModelSummary
assetModelSummary_id = (AssetModelSummary -> Text)
-> (AssetModelSummary -> Text -> AssetModelSummary)
-> Lens AssetModelSummary AssetModelSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {Text
id :: Text
$sel:id:AssetModelSummary' :: AssetModelSummary -> Text
id} -> Text
id) (\s :: AssetModelSummary
s@AssetModelSummary' {} Text
a -> AssetModelSummary
s {$sel:id:AssetModelSummary' :: Text
id = Text
a} :: AssetModelSummary)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the asset model, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model\/${AssetModelId}@
assetModelSummary_arn :: Lens.Lens' AssetModelSummary Prelude.Text
assetModelSummary_arn :: (Text -> f Text) -> AssetModelSummary -> f AssetModelSummary
assetModelSummary_arn = (AssetModelSummary -> Text)
-> (AssetModelSummary -> Text -> AssetModelSummary)
-> Lens AssetModelSummary AssetModelSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {Text
arn :: Text
$sel:arn:AssetModelSummary' :: AssetModelSummary -> Text
arn} -> Text
arn) (\s :: AssetModelSummary
s@AssetModelSummary' {} Text
a -> AssetModelSummary
s {$sel:arn:AssetModelSummary' :: Text
arn = Text
a} :: AssetModelSummary)

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

-- | The asset model description.
assetModelSummary_description :: Lens.Lens' AssetModelSummary Prelude.Text
assetModelSummary_description :: (Text -> f Text) -> AssetModelSummary -> f AssetModelSummary
assetModelSummary_description = (AssetModelSummary -> Text)
-> (AssetModelSummary -> Text -> AssetModelSummary)
-> Lens AssetModelSummary AssetModelSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {Text
description :: Text
$sel:description:AssetModelSummary' :: AssetModelSummary -> Text
description} -> Text
description) (\s :: AssetModelSummary
s@AssetModelSummary' {} Text
a -> AssetModelSummary
s {$sel:description:AssetModelSummary' :: Text
description = Text
a} :: AssetModelSummary)

-- | The date the asset model was created, in Unix epoch time.
assetModelSummary_creationDate :: Lens.Lens' AssetModelSummary Prelude.UTCTime
assetModelSummary_creationDate :: (UTCTime -> f UTCTime) -> AssetModelSummary -> f AssetModelSummary
assetModelSummary_creationDate = (AssetModelSummary -> POSIX)
-> (AssetModelSummary -> POSIX -> AssetModelSummary)
-> Lens AssetModelSummary AssetModelSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {POSIX
creationDate :: POSIX
$sel:creationDate:AssetModelSummary' :: AssetModelSummary -> POSIX
creationDate} -> POSIX
creationDate) (\s :: AssetModelSummary
s@AssetModelSummary' {} POSIX
a -> AssetModelSummary
s {$sel:creationDate:AssetModelSummary' :: POSIX
creationDate = POSIX
a} :: AssetModelSummary) ((POSIX -> f POSIX) -> AssetModelSummary -> f AssetModelSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AssetModelSummary
-> f AssetModelSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date the asset model was last updated, in Unix epoch time.
assetModelSummary_lastUpdateDate :: Lens.Lens' AssetModelSummary Prelude.UTCTime
assetModelSummary_lastUpdateDate :: (UTCTime -> f UTCTime) -> AssetModelSummary -> f AssetModelSummary
assetModelSummary_lastUpdateDate = (AssetModelSummary -> POSIX)
-> (AssetModelSummary -> POSIX -> AssetModelSummary)
-> Lens AssetModelSummary AssetModelSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {POSIX
lastUpdateDate :: POSIX
$sel:lastUpdateDate:AssetModelSummary' :: AssetModelSummary -> POSIX
lastUpdateDate} -> POSIX
lastUpdateDate) (\s :: AssetModelSummary
s@AssetModelSummary' {} POSIX
a -> AssetModelSummary
s {$sel:lastUpdateDate:AssetModelSummary' :: POSIX
lastUpdateDate = POSIX
a} :: AssetModelSummary) ((POSIX -> f POSIX) -> AssetModelSummary -> f AssetModelSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AssetModelSummary
-> f AssetModelSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The current status of the asset model.
assetModelSummary_status :: Lens.Lens' AssetModelSummary AssetModelStatus
assetModelSummary_status :: (AssetModelStatus -> f AssetModelStatus)
-> AssetModelSummary -> f AssetModelSummary
assetModelSummary_status = (AssetModelSummary -> AssetModelStatus)
-> (AssetModelSummary -> AssetModelStatus -> AssetModelSummary)
-> Lens
     AssetModelSummary
     AssetModelSummary
     AssetModelStatus
     AssetModelStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetModelSummary' {AssetModelStatus
status :: AssetModelStatus
$sel:status:AssetModelSummary' :: AssetModelSummary -> AssetModelStatus
status} -> AssetModelStatus
status) (\s :: AssetModelSummary
s@AssetModelSummary' {} AssetModelStatus
a -> AssetModelSummary
s {$sel:status:AssetModelSummary' :: AssetModelStatus
status = AssetModelStatus
a} :: AssetModelSummary)

instance Core.FromJSON AssetModelSummary where
  parseJSON :: Value -> Parser AssetModelSummary
parseJSON =
    String
-> (Object -> Parser AssetModelSummary)
-> Value
-> Parser AssetModelSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssetModelSummary"
      ( \Object
x ->
          Text
-> Text
-> Text
-> Text
-> POSIX
-> POSIX
-> AssetModelStatus
-> AssetModelSummary
AssetModelSummary'
            (Text
 -> Text
 -> Text
 -> Text
 -> POSIX
 -> POSIX
 -> AssetModelStatus
 -> AssetModelSummary)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> Text
      -> POSIX
      -> POSIX
      -> AssetModelStatus
      -> AssetModelSummary)
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
"id")
            Parser
  (Text
   -> Text
   -> Text
   -> POSIX
   -> POSIX
   -> AssetModelStatus
   -> AssetModelSummary)
-> Parser Text
-> Parser
     (Text
      -> Text -> POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
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
"arn")
            Parser
  (Text
   -> Text -> POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
-> Parser Text
-> Parser
     (Text -> POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
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
"name")
            Parser
  (Text -> POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
-> Parser Text
-> Parser (POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
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
"description")
            Parser (POSIX -> POSIX -> AssetModelStatus -> AssetModelSummary)
-> Parser POSIX
-> Parser (POSIX -> AssetModelStatus -> AssetModelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"creationDate")
            Parser (POSIX -> AssetModelStatus -> AssetModelSummary)
-> Parser POSIX -> Parser (AssetModelStatus -> AssetModelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"lastUpdateDate")
            Parser (AssetModelStatus -> AssetModelSummary)
-> Parser AssetModelStatus -> Parser AssetModelSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AssetModelStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance Prelude.Hashable AssetModelSummary

instance Prelude.NFData AssetModelSummary