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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 :: Core.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 :: Core.POSIX
  }
  deriving (ProjectSummary -> ProjectSummary -> Bool
(ProjectSummary -> ProjectSummary -> Bool)
-> (ProjectSummary -> ProjectSummary -> Bool) -> Eq ProjectSummary
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]
(Int -> ReadS ProjectSummary)
-> ReadS [ProjectSummary]
-> ReadPrec ProjectSummary
-> ReadPrec [ProjectSummary]
-> Read 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
(Int -> ProjectSummary -> ShowS)
-> (ProjectSummary -> String)
-> ([ProjectSummary] -> ShowS)
-> Show ProjectSummary
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. ProjectSummary -> Rep ProjectSummary x)
-> (forall x. Rep ProjectSummary x -> ProjectSummary)
-> Generic ProjectSummary
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' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectSummary
ProjectSummary'
      { $sel:arn:ProjectSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ProjectSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:projectName:ProjectSummary' :: Text
projectName = Text
pProjectName_,
        $sel:createdDate:ProjectSummary' :: POSIX
createdDate = 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
pCreatedDate_,
        $sel:updatedDate:ProjectSummary' :: POSIX
updatedDate = 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
pUpdatedDate_
      }

-- | The ARN of the project.
projectSummary_arn :: Lens.Lens' ProjectSummary (Prelude.Maybe Prelude.Text)
projectSummary_arn :: (Maybe Text -> f (Maybe Text))
-> ProjectSummary -> f ProjectSummary
projectSummary_arn = (ProjectSummary -> Maybe Text)
-> (ProjectSummary -> Maybe Text -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary (Maybe Text) (Maybe Text)
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 :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProjectSummary -> f ProjectSummary
projectSummary_tags = (ProjectSummary -> Maybe (HashMap Text Text))
-> (ProjectSummary -> Maybe (HashMap Text Text) -> ProjectSummary)
-> Lens
     ProjectSummary
     ProjectSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ProjectSummary -> f ProjectSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProjectSummary
-> f ProjectSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
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 :: (Text -> f Text) -> ProjectSummary -> f ProjectSummary
projectSummary_projectName = (ProjectSummary -> Text)
-> (ProjectSummary -> Text -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary Text Text
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 :: (UTCTime -> f UTCTime) -> ProjectSummary -> f ProjectSummary
projectSummary_createdDate = (ProjectSummary -> POSIX)
-> (ProjectSummary -> POSIX -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary POSIX POSIX
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) ((POSIX -> f POSIX) -> ProjectSummary -> f ProjectSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ProjectSummary
-> f ProjectSummary
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 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 :: (UTCTime -> f UTCTime) -> ProjectSummary -> f ProjectSummary
projectSummary_updatedDate = (ProjectSummary -> POSIX)
-> (ProjectSummary -> POSIX -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary POSIX POSIX
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) ((POSIX -> f POSIX) -> ProjectSummary -> f ProjectSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ProjectSummary
-> f ProjectSummary
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

instance Core.FromJSON ProjectSummary where
  parseJSON :: Value -> Parser ProjectSummary
parseJSON =
    String
-> (Object -> Parser ProjectSummary)
-> Value
-> Parser ProjectSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProjectSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectSummary
ProjectSummary'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> POSIX
 -> POSIX
 -> ProjectSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text -> POSIX -> POSIX -> ProjectSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
            Parser
  (Maybe (HashMap Text Text)
   -> Text -> POSIX -> POSIX -> ProjectSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> POSIX -> POSIX -> ProjectSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> POSIX -> POSIX -> ProjectSummary)
-> Parser Text -> Parser (POSIX -> POSIX -> ProjectSummary)
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
"projectName")
            Parser (POSIX -> POSIX -> ProjectSummary)
-> Parser POSIX -> Parser (POSIX -> ProjectSummary)
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
"createdDate")
            Parser (POSIX -> ProjectSummary)
-> Parser POSIX -> Parser ProjectSummary
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
"updatedDate")
      )

instance Prelude.Hashable ProjectSummary

instance Prelude.NFData ProjectSummary