{-# 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.IotTwinMaker.Types.EntitySummary
-- 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.IotTwinMaker.Types.EntitySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.Status
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information about an entity.
--
-- /See:/ 'newEntitySummary' smart constructor.
data EntitySummary = EntitySummary'
  { -- | The description of the entity.
    EntitySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A Boolean value that specifies whether the entity has child entities or
    -- not.
    EntitySummary -> Maybe Bool
hasChildEntities :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the parent entity.
    EntitySummary -> Maybe Text
parentEntityId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the entity.
    EntitySummary -> Text
entityId :: Prelude.Text,
    -- | The name of the entity.
    EntitySummary -> Text
entityName :: Prelude.Text,
    -- | The ARN of the entity.
    EntitySummary -> Text
arn :: Prelude.Text,
    -- | The current status of the entity.
    EntitySummary -> Status
status :: Status,
    -- | The date and time when the entity was created.
    EntitySummary -> POSIX
creationDateTime :: Data.POSIX,
    -- | The last date and time when the entity was updated.
    EntitySummary -> POSIX
updateDateTime :: Data.POSIX
  }
  deriving (EntitySummary -> EntitySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntitySummary -> EntitySummary -> Bool
$c/= :: EntitySummary -> EntitySummary -> Bool
== :: EntitySummary -> EntitySummary -> Bool
$c== :: EntitySummary -> EntitySummary -> Bool
Prelude.Eq, ReadPrec [EntitySummary]
ReadPrec EntitySummary
Int -> ReadS EntitySummary
ReadS [EntitySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntitySummary]
$creadListPrec :: ReadPrec [EntitySummary]
readPrec :: ReadPrec EntitySummary
$creadPrec :: ReadPrec EntitySummary
readList :: ReadS [EntitySummary]
$creadList :: ReadS [EntitySummary]
readsPrec :: Int -> ReadS EntitySummary
$creadsPrec :: Int -> ReadS EntitySummary
Prelude.Read, Int -> EntitySummary -> ShowS
[EntitySummary] -> ShowS
EntitySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntitySummary] -> ShowS
$cshowList :: [EntitySummary] -> ShowS
show :: EntitySummary -> String
$cshow :: EntitySummary -> String
showsPrec :: Int -> EntitySummary -> ShowS
$cshowsPrec :: Int -> EntitySummary -> ShowS
Prelude.Show, forall x. Rep EntitySummary x -> EntitySummary
forall x. EntitySummary -> Rep EntitySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EntitySummary x -> EntitySummary
$cfrom :: forall x. EntitySummary -> Rep EntitySummary x
Prelude.Generic)

-- |
-- Create a value of 'EntitySummary' 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:
--
-- 'description', 'entitySummary_description' - The description of the entity.
--
-- 'hasChildEntities', 'entitySummary_hasChildEntities' - A Boolean value that specifies whether the entity has child entities or
-- not.
--
-- 'parentEntityId', 'entitySummary_parentEntityId' - The ID of the parent entity.
--
-- 'entityId', 'entitySummary_entityId' - The ID of the entity.
--
-- 'entityName', 'entitySummary_entityName' - The name of the entity.
--
-- 'arn', 'entitySummary_arn' - The ARN of the entity.
--
-- 'status', 'entitySummary_status' - The current status of the entity.
--
-- 'creationDateTime', 'entitySummary_creationDateTime' - The date and time when the entity was created.
--
-- 'updateDateTime', 'entitySummary_updateDateTime' - The last date and time when the entity was updated.
newEntitySummary ::
  -- | 'entityId'
  Prelude.Text ->
  -- | 'entityName'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'status'
  Status ->
  -- | 'creationDateTime'
  Prelude.UTCTime ->
  -- | 'updateDateTime'
  Prelude.UTCTime ->
  EntitySummary
newEntitySummary :: Text
-> Text -> Text -> Status -> UTCTime -> UTCTime -> EntitySummary
newEntitySummary
  Text
pEntityId_
  Text
pEntityName_
  Text
pArn_
  Status
pStatus_
  UTCTime
pCreationDateTime_
  UTCTime
pUpdateDateTime_ =
    EntitySummary'
      { $sel:description:EntitySummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:hasChildEntities:EntitySummary' :: Maybe Bool
hasChildEntities = forall a. Maybe a
Prelude.Nothing,
        $sel:parentEntityId:EntitySummary' :: Maybe Text
parentEntityId = forall a. Maybe a
Prelude.Nothing,
        $sel:entityId:EntitySummary' :: Text
entityId = Text
pEntityId_,
        $sel:entityName:EntitySummary' :: Text
entityName = Text
pEntityName_,
        $sel:arn:EntitySummary' :: Text
arn = Text
pArn_,
        $sel:status:EntitySummary' :: Status
status = Status
pStatus_,
        $sel:creationDateTime:EntitySummary' :: POSIX
creationDateTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDateTime_,
        $sel:updateDateTime:EntitySummary' :: POSIX
updateDateTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDateTime_
      }

-- | The description of the entity.
entitySummary_description :: Lens.Lens' EntitySummary (Prelude.Maybe Prelude.Text)
entitySummary_description :: Lens' EntitySummary (Maybe Text)
entitySummary_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Maybe Text
description :: Maybe Text
$sel:description:EntitySummary' :: EntitySummary -> Maybe Text
description} -> Maybe Text
description) (\s :: EntitySummary
s@EntitySummary' {} Maybe Text
a -> EntitySummary
s {$sel:description:EntitySummary' :: Maybe Text
description = Maybe Text
a} :: EntitySummary)

-- | A Boolean value that specifies whether the entity has child entities or
-- not.
entitySummary_hasChildEntities :: Lens.Lens' EntitySummary (Prelude.Maybe Prelude.Bool)
entitySummary_hasChildEntities :: Lens' EntitySummary (Maybe Bool)
entitySummary_hasChildEntities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Maybe Bool
hasChildEntities :: Maybe Bool
$sel:hasChildEntities:EntitySummary' :: EntitySummary -> Maybe Bool
hasChildEntities} -> Maybe Bool
hasChildEntities) (\s :: EntitySummary
s@EntitySummary' {} Maybe Bool
a -> EntitySummary
s {$sel:hasChildEntities:EntitySummary' :: Maybe Bool
hasChildEntities = Maybe Bool
a} :: EntitySummary)

-- | The ID of the parent entity.
entitySummary_parentEntityId :: Lens.Lens' EntitySummary (Prelude.Maybe Prelude.Text)
entitySummary_parentEntityId :: Lens' EntitySummary (Maybe Text)
entitySummary_parentEntityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Maybe Text
parentEntityId :: Maybe Text
$sel:parentEntityId:EntitySummary' :: EntitySummary -> Maybe Text
parentEntityId} -> Maybe Text
parentEntityId) (\s :: EntitySummary
s@EntitySummary' {} Maybe Text
a -> EntitySummary
s {$sel:parentEntityId:EntitySummary' :: Maybe Text
parentEntityId = Maybe Text
a} :: EntitySummary)

-- | The ID of the entity.
entitySummary_entityId :: Lens.Lens' EntitySummary Prelude.Text
entitySummary_entityId :: Lens' EntitySummary Text
entitySummary_entityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Text
entityId :: Text
$sel:entityId:EntitySummary' :: EntitySummary -> Text
entityId} -> Text
entityId) (\s :: EntitySummary
s@EntitySummary' {} Text
a -> EntitySummary
s {$sel:entityId:EntitySummary' :: Text
entityId = Text
a} :: EntitySummary)

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

-- | The ARN of the entity.
entitySummary_arn :: Lens.Lens' EntitySummary Prelude.Text
entitySummary_arn :: Lens' EntitySummary Text
entitySummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Text
arn :: Text
$sel:arn:EntitySummary' :: EntitySummary -> Text
arn} -> Text
arn) (\s :: EntitySummary
s@EntitySummary' {} Text
a -> EntitySummary
s {$sel:arn:EntitySummary' :: Text
arn = Text
a} :: EntitySummary)

-- | The current status of the entity.
entitySummary_status :: Lens.Lens' EntitySummary Status
entitySummary_status :: Lens' EntitySummary Status
entitySummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {Status
status :: Status
$sel:status:EntitySummary' :: EntitySummary -> Status
status} -> Status
status) (\s :: EntitySummary
s@EntitySummary' {} Status
a -> EntitySummary
s {$sel:status:EntitySummary' :: Status
status = Status
a} :: EntitySummary)

-- | The date and time when the entity was created.
entitySummary_creationDateTime :: Lens.Lens' EntitySummary Prelude.UTCTime
entitySummary_creationDateTime :: Lens' EntitySummary UTCTime
entitySummary_creationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {POSIX
creationDateTime :: POSIX
$sel:creationDateTime:EntitySummary' :: EntitySummary -> POSIX
creationDateTime} -> POSIX
creationDateTime) (\s :: EntitySummary
s@EntitySummary' {} POSIX
a -> EntitySummary
s {$sel:creationDateTime:EntitySummary' :: POSIX
creationDateTime = POSIX
a} :: EntitySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The last date and time when the entity was updated.
entitySummary_updateDateTime :: Lens.Lens' EntitySummary Prelude.UTCTime
entitySummary_updateDateTime :: Lens' EntitySummary UTCTime
entitySummary_updateDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitySummary' {POSIX
updateDateTime :: POSIX
$sel:updateDateTime:EntitySummary' :: EntitySummary -> POSIX
updateDateTime} -> POSIX
updateDateTime) (\s :: EntitySummary
s@EntitySummary' {} POSIX
a -> EntitySummary
s {$sel:updateDateTime:EntitySummary' :: POSIX
updateDateTime = POSIX
a} :: EntitySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON EntitySummary where
  parseJSON :: Value -> Parser EntitySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EntitySummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> Text
-> Text
-> Status
-> POSIX
-> POSIX
-> EntitySummary
EntitySummary'
            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
"description")
            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
"hasChildEntities")
            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
"parentEntityId")
            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
"entityId")
            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
"entityName")
            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
"arn")
            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
"status")
            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
"creationDateTime")
            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
"updateDateTime")
      )

instance Prelude.Hashable EntitySummary where
  hashWithSalt :: Int -> EntitySummary -> Int
hashWithSalt Int
_salt EntitySummary' {Maybe Bool
Maybe Text
Text
POSIX
Status
updateDateTime :: POSIX
creationDateTime :: POSIX
status :: Status
arn :: Text
entityName :: Text
entityId :: Text
parentEntityId :: Maybe Text
hasChildEntities :: Maybe Bool
description :: Maybe Text
$sel:updateDateTime:EntitySummary' :: EntitySummary -> POSIX
$sel:creationDateTime:EntitySummary' :: EntitySummary -> POSIX
$sel:status:EntitySummary' :: EntitySummary -> Status
$sel:arn:EntitySummary' :: EntitySummary -> Text
$sel:entityName:EntitySummary' :: EntitySummary -> Text
$sel:entityId:EntitySummary' :: EntitySummary -> Text
$sel:parentEntityId:EntitySummary' :: EntitySummary -> Maybe Text
$sel:hasChildEntities:EntitySummary' :: EntitySummary -> Maybe Bool
$sel:description:EntitySummary' :: EntitySummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasChildEntities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parentEntityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
entityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
entityName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Status
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
updateDateTime

instance Prelude.NFData EntitySummary where
  rnf :: EntitySummary -> ()
rnf EntitySummary' {Maybe Bool
Maybe Text
Text
POSIX
Status
updateDateTime :: POSIX
creationDateTime :: POSIX
status :: Status
arn :: Text
entityName :: Text
entityId :: Text
parentEntityId :: Maybe Text
hasChildEntities :: Maybe Bool
description :: Maybe Text
$sel:updateDateTime:EntitySummary' :: EntitySummary -> POSIX
$sel:creationDateTime:EntitySummary' :: EntitySummary -> POSIX
$sel:status:EntitySummary' :: EntitySummary -> Status
$sel:arn:EntitySummary' :: EntitySummary -> Text
$sel:entityName:EntitySummary' :: EntitySummary -> Text
$sel:entityId:EntitySummary' :: EntitySummary -> Text
$sel:parentEntityId:EntitySummary' :: EntitySummary -> Maybe Text
$sel:hasChildEntities:EntitySummary' :: EntitySummary -> Maybe Bool
$sel:description:EntitySummary' :: EntitySummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasChildEntities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
parentEntityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
entityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
entityName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Status
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updateDateTime