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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An object providing summary information for a particular project for an
-- associated AWS account and region.
--
-- /See:/ 'newProjectSummary' smart constructor.
data ProjectSummary = ProjectSummary'
  { -- | The ARN of the project.
    ProjectSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The tags (metadata key\/value pairs) associated with the project.
    ProjectSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the project being summarized.
    ProjectSummary -> Text
projectName :: Prelude.Text,
    -- | The date when the project was originally created, in UNIX epoch time
    -- format.
    ProjectSummary -> 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.
    ProjectSummary -> POSIX
updatedDate :: Data.POSIX
  }
  deriving (ProjectSummary -> ProjectSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectSummary -> ProjectSummary -> Bool
$c/= :: ProjectSummary -> ProjectSummary -> Bool
== :: ProjectSummary -> ProjectSummary -> Bool
$c== :: ProjectSummary -> ProjectSummary -> Bool
Prelude.Eq, ReadPrec [ProjectSummary]
ReadPrec ProjectSummary
Int -> ReadS ProjectSummary
ReadS [ProjectSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectSummary]
$creadListPrec :: ReadPrec [ProjectSummary]
readPrec :: ReadPrec ProjectSummary
$creadPrec :: ReadPrec ProjectSummary
readList :: ReadS [ProjectSummary]
$creadList :: ReadS [ProjectSummary]
readsPrec :: Int -> ReadS ProjectSummary
$creadsPrec :: Int -> ReadS ProjectSummary
Prelude.Read, Int -> ProjectSummary -> ShowS
[ProjectSummary] -> ShowS
ProjectSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectSummary] -> ShowS
$cshowList :: [ProjectSummary] -> ShowS
show :: ProjectSummary -> String
$cshow :: ProjectSummary -> String
showsPrec :: Int -> ProjectSummary -> ShowS
$cshowsPrec :: Int -> ProjectSummary -> ShowS
Prelude.Show, forall x. Rep ProjectSummary x -> ProjectSummary
forall x. ProjectSummary -> Rep ProjectSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectSummary x -> ProjectSummary
$cfrom :: forall x. ProjectSummary -> Rep ProjectSummary x
Prelude.Generic)

-- |
-- Create a value of 'ProjectSummary' 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', 'projectSummary_arn' - The ARN of the project.
--
-- 'tags', 'projectSummary_tags' - The tags (metadata key\/value pairs) associated with the project.
--
-- 'projectName', 'projectSummary_projectName' - The name of the project being summarized.
--
-- 'createdDate', 'projectSummary_createdDate' - The date when the project was originally created, in UNIX epoch time
-- format.
--
-- 'updatedDate', 'projectSummary_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.
newProjectSummary ::
  -- | 'projectName'
  Prelude.Text ->
  -- | 'createdDate'
  Prelude.UTCTime ->
  -- | 'updatedDate'
  Prelude.UTCTime ->
  ProjectSummary
newProjectSummary :: Text -> UTCTime -> UTCTime -> ProjectSummary
newProjectSummary
  Text
pProjectName_
  UTCTime
pCreatedDate_
  UTCTime
pUpdatedDate_ =
    ProjectSummary'
      { $sel:arn:ProjectSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ProjectSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:projectName:ProjectSummary' :: Text
projectName = Text
pProjectName_,
        $sel:createdDate:ProjectSummary' :: POSIX
createdDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedDate_,
        $sel:updatedDate:ProjectSummary' :: 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.
projectSummary_arn :: Lens.Lens' ProjectSummary (Prelude.Maybe Prelude.Text)
projectSummary_arn :: Lens' ProjectSummary (Maybe Text)
projectSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:ProjectSummary' :: ProjectSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ProjectSummary
s@ProjectSummary' {} Maybe Text
a -> ProjectSummary
s {$sel:arn:ProjectSummary' :: Maybe Text
arn = Maybe Text
a} :: ProjectSummary)

-- | The tags (metadata key\/value pairs) associated with the project.
projectSummary_tags :: Lens.Lens' ProjectSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
projectSummary_tags :: Lens' ProjectSummary (Maybe (HashMap Text Text))
projectSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ProjectSummary' :: ProjectSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ProjectSummary
s@ProjectSummary' {} Maybe (HashMap Text Text)
a -> ProjectSummary
s {$sel:tags:ProjectSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ProjectSummary) 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 being summarized.
projectSummary_projectName :: Lens.Lens' ProjectSummary Prelude.Text
projectSummary_projectName :: Lens' ProjectSummary Text
projectSummary_projectName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSummary' {Text
projectName :: Text
$sel:projectName:ProjectSummary' :: ProjectSummary -> Text
projectName} -> Text
projectName) (\s :: ProjectSummary
s@ProjectSummary' {} Text
a -> ProjectSummary
s {$sel:projectName:ProjectSummary' :: Text
projectName = Text
a} :: ProjectSummary)

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

instance Data.FromJSON ProjectSummary where
  parseJSON :: Value -> Parser ProjectSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectSummary
ProjectSummary'
            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
"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 ProjectSummary where
  hashWithSalt :: Int -> ProjectSummary -> Int
hashWithSalt Int
_salt ProjectSummary' {Maybe Text
Maybe (HashMap Text Text)
Text
POSIX
updatedDate :: POSIX
createdDate :: POSIX
projectName :: Text
tags :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:updatedDate:ProjectSummary' :: ProjectSummary -> POSIX
$sel:createdDate:ProjectSummary' :: ProjectSummary -> POSIX
$sel:projectName:ProjectSummary' :: ProjectSummary -> Text
$sel:tags:ProjectSummary' :: ProjectSummary -> Maybe (HashMap Text Text)
$sel:arn:ProjectSummary' :: ProjectSummary -> 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 (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 ProjectSummary where
  rnf :: ProjectSummary -> ()
rnf ProjectSummary' {Maybe Text
Maybe (HashMap Text Text)
Text
POSIX
updatedDate :: POSIX
createdDate :: POSIX
projectName :: Text
tags :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:updatedDate:ProjectSummary' :: ProjectSummary -> POSIX
$sel:createdDate:ProjectSummary' :: ProjectSummary -> POSIX
$sel:projectName:ProjectSummary' :: ProjectSummary -> Text
$sel:tags:ProjectSummary' :: ProjectSummary -> Maybe (HashMap Text Text)
$sel:arn:ProjectSummary' :: ProjectSummary -> 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 (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