{-# 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.IoT1ClickProjects.Types.ProjectDescription
-- 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.IoT1ClickProjects.Types.ProjectDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT1ClickProjects.Types.PlacementTemplate
import qualified Amazonka.Prelude as Prelude

-- | An object providing detailed information for a particular project
-- associated with an AWS account and region.
--
-- /See:/ 'newProjectDescription' smart constructor.
data ProjectDescription = ProjectDescription'
  { -- | The ARN of the project.
    ProjectDescription -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The description of the project.
    ProjectDescription -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | An object describing the project\'s placement specifications.
    ProjectDescription -> Maybe PlacementTemplate
placementTemplate :: Prelude.Maybe PlacementTemplate,
    -- | The tags (metadata key\/value pairs) associated with the project.
    ProjectDescription -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the project for which to obtain information from.
    ProjectDescription -> Text
projectName :: Prelude.Text,
    -- | The date when the project was originally created, in UNIX epoch time
    -- format.
    ProjectDescription -> POSIX
createdDate :: Data.POSIX,
    -- | The date when the project was last updated, in UNIX epoch time format.
    -- If the project was not updated, then @createdDate@ and @updatedDate@ are
    -- the same.
    ProjectDescription -> POSIX
updatedDate :: Data.POSIX
  }
  deriving (ProjectDescription -> ProjectDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectDescription -> ProjectDescription -> Bool
$c/= :: ProjectDescription -> ProjectDescription -> Bool
== :: ProjectDescription -> ProjectDescription -> Bool
$c== :: ProjectDescription -> ProjectDescription -> Bool
Prelude.Eq, ReadPrec [ProjectDescription]
ReadPrec ProjectDescription
Int -> ReadS ProjectDescription
ReadS [ProjectDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectDescription]
$creadListPrec :: ReadPrec [ProjectDescription]
readPrec :: ReadPrec ProjectDescription
$creadPrec :: ReadPrec ProjectDescription
readList :: ReadS [ProjectDescription]
$creadList :: ReadS [ProjectDescription]
readsPrec :: Int -> ReadS ProjectDescription
$creadsPrec :: Int -> ReadS ProjectDescription
Prelude.Read, Int -> ProjectDescription -> ShowS
[ProjectDescription] -> ShowS
ProjectDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectDescription] -> ShowS
$cshowList :: [ProjectDescription] -> ShowS
show :: ProjectDescription -> String
$cshow :: ProjectDescription -> String
showsPrec :: Int -> ProjectDescription -> ShowS
$cshowsPrec :: Int -> ProjectDescription -> ShowS
Prelude.Show, forall x. Rep ProjectDescription x -> ProjectDescription
forall x. ProjectDescription -> Rep ProjectDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectDescription x -> ProjectDescription
$cfrom :: forall x. ProjectDescription -> Rep ProjectDescription x
Prelude.Generic)

-- |
-- Create a value of 'ProjectDescription' 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:
--
-- 'arn', 'projectDescription_arn' - The ARN of the project.
--
-- 'description', 'projectDescription_description' - The description of the project.
--
-- 'placementTemplate', 'projectDescription_placementTemplate' - An object describing the project\'s placement specifications.
--
-- 'tags', 'projectDescription_tags' - The tags (metadata key\/value pairs) associated with the project.
--
-- 'projectName', 'projectDescription_projectName' - The name of the project for which to obtain information from.
--
-- 'createdDate', 'projectDescription_createdDate' - The date when the project was originally created, in UNIX epoch time
-- format.
--
-- 'updatedDate', 'projectDescription_updatedDate' - The date when the project was last updated, in UNIX epoch time format.
-- If the project was not updated, then @createdDate@ and @updatedDate@ are
-- the same.
newProjectDescription ::
  -- | 'projectName'
  Prelude.Text ->
  -- | 'createdDate'
  Prelude.UTCTime ->
  -- | 'updatedDate'
  Prelude.UTCTime ->
  ProjectDescription
newProjectDescription :: Text -> UTCTime -> UTCTime -> ProjectDescription
newProjectDescription
  Text
pProjectName_
  UTCTime
pCreatedDate_
  UTCTime
pUpdatedDate_ =
    ProjectDescription'
      { $sel:arn:ProjectDescription' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
        $sel:description:ProjectDescription' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:placementTemplate:ProjectDescription' :: Maybe PlacementTemplate
placementTemplate = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ProjectDescription' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:projectName:ProjectDescription' :: Text
projectName = Text
pProjectName_,
        $sel:createdDate:ProjectDescription' :: POSIX
createdDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedDate_,
        $sel:updatedDate:ProjectDescription' :: POSIX
updatedDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedDate_
      }

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

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

-- | An object describing the project\'s placement specifications.
projectDescription_placementTemplate :: Lens.Lens' ProjectDescription (Prelude.Maybe PlacementTemplate)
projectDescription_placementTemplate :: Lens' ProjectDescription (Maybe PlacementTemplate)
projectDescription_placementTemplate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Maybe PlacementTemplate
placementTemplate :: Maybe PlacementTemplate
$sel:placementTemplate:ProjectDescription' :: ProjectDescription -> Maybe PlacementTemplate
placementTemplate} -> Maybe PlacementTemplate
placementTemplate) (\s :: ProjectDescription
s@ProjectDescription' {} Maybe PlacementTemplate
a -> ProjectDescription
s {$sel:placementTemplate:ProjectDescription' :: Maybe PlacementTemplate
placementTemplate = Maybe PlacementTemplate
a} :: ProjectDescription)

-- | The tags (metadata key\/value pairs) associated with the project.
projectDescription_tags :: Lens.Lens' ProjectDescription (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
projectDescription_tags :: Lens' ProjectDescription (Maybe (HashMap Text Text))
projectDescription_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ProjectDescription' :: ProjectDescription -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ProjectDescription
s@ProjectDescription' {} Maybe (HashMap Text Text)
a -> ProjectDescription
s {$sel:tags:ProjectDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ProjectDescription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the project for which to obtain information from.
projectDescription_projectName :: Lens.Lens' ProjectDescription Prelude.Text
projectDescription_projectName :: Lens' ProjectDescription Text
projectDescription_projectName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Text
projectName :: Text
$sel:projectName:ProjectDescription' :: ProjectDescription -> Text
projectName} -> Text
projectName) (\s :: ProjectDescription
s@ProjectDescription' {} Text
a -> ProjectDescription
s {$sel:projectName:ProjectDescription' :: Text
projectName = Text
a} :: ProjectDescription)

-- | The date when the project was originally created, in UNIX epoch time
-- format.
projectDescription_createdDate :: Lens.Lens' ProjectDescription Prelude.UTCTime
projectDescription_createdDate :: Lens' ProjectDescription UTCTime
projectDescription_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {POSIX
createdDate :: POSIX
$sel:createdDate:ProjectDescription' :: ProjectDescription -> POSIX
createdDate} -> POSIX
createdDate) (\s :: ProjectDescription
s@ProjectDescription' {} POSIX
a -> ProjectDescription
s {$sel:createdDate:ProjectDescription' :: POSIX
createdDate = POSIX
a} :: ProjectDescription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date when the project was last updated, in UNIX epoch time format.
-- If the project was not updated, then @createdDate@ and @updatedDate@ are
-- the same.
projectDescription_updatedDate :: Lens.Lens' ProjectDescription Prelude.UTCTime
projectDescription_updatedDate :: Lens' ProjectDescription UTCTime
projectDescription_updatedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {POSIX
updatedDate :: POSIX
$sel:updatedDate:ProjectDescription' :: ProjectDescription -> POSIX
updatedDate} -> POSIX
updatedDate) (\s :: ProjectDescription
s@ProjectDescription' {} POSIX
a -> ProjectDescription
s {$sel:updatedDate:ProjectDescription' :: POSIX
updatedDate = POSIX
a} :: ProjectDescription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ProjectDescription where
  parseJSON :: Value -> Parser ProjectDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe PlacementTemplate
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectDescription
ProjectDescription'
            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
"arn")
            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
"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
"placementTemplate")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"projectName")
            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
"createdDate")
            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
"updatedDate")
      )

instance Prelude.Hashable ProjectDescription where
  hashWithSalt :: Int -> ProjectDescription -> Int
hashWithSalt Int
_salt ProjectDescription' {Maybe Text
Maybe (HashMap Text Text)
Maybe PlacementTemplate
Text
POSIX
updatedDate :: POSIX
createdDate :: POSIX
projectName :: Text
tags :: Maybe (HashMap Text Text)
placementTemplate :: Maybe PlacementTemplate
description :: Maybe Text
arn :: Maybe Text
$sel:updatedDate:ProjectDescription' :: ProjectDescription -> POSIX
$sel:createdDate:ProjectDescription' :: ProjectDescription -> POSIX
$sel:projectName:ProjectDescription' :: ProjectDescription -> Text
$sel:tags:ProjectDescription' :: ProjectDescription -> Maybe (HashMap Text Text)
$sel:placementTemplate:ProjectDescription' :: ProjectDescription -> Maybe PlacementTemplate
$sel:description:ProjectDescription' :: ProjectDescription -> Maybe Text
$sel:arn:ProjectDescription' :: ProjectDescription -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlacementTemplate
placementTemplate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
projectName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
updatedDate

instance Prelude.NFData ProjectDescription where
  rnf :: ProjectDescription -> ()
rnf ProjectDescription' {Maybe Text
Maybe (HashMap Text Text)
Maybe PlacementTemplate
Text
POSIX
updatedDate :: POSIX
createdDate :: POSIX
projectName :: Text
tags :: Maybe (HashMap Text Text)
placementTemplate :: Maybe PlacementTemplate
description :: Maybe Text
arn :: Maybe Text
$sel:updatedDate:ProjectDescription' :: ProjectDescription -> POSIX
$sel:createdDate:ProjectDescription' :: ProjectDescription -> POSIX
$sel:projectName:ProjectDescription' :: ProjectDescription -> Text
$sel:tags:ProjectDescription' :: ProjectDescription -> Maybe (HashMap Text Text)
$sel:placementTemplate:ProjectDescription' :: ProjectDescription -> Maybe PlacementTemplate
$sel:description:ProjectDescription' :: ProjectDescription -> Maybe Text
$sel:arn:ProjectDescription' :: ProjectDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 PlacementTemplate
placementTemplate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
projectName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updatedDate