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

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

-- | Contains project summary information.
--
-- /See:/ 'newProjectSummary' smart constructor.
data ProjectSummary = ProjectSummary'
  { -- | The date the project was last updated, in Unix epoch time.
    ProjectSummary -> Maybe POSIX
lastUpdateDate :: Prelude.Maybe Core.POSIX,
    -- | The date the project was created, in Unix epoch time.
    ProjectSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The project\'s description.
    ProjectSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the project.
    ProjectSummary -> Text
id :: Prelude.Text,
    -- | The name of the project.
    ProjectSummary -> Text
name :: Prelude.Text
  }
  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:
--
-- 'lastUpdateDate', 'projectSummary_lastUpdateDate' - The date the project was last updated, in Unix epoch time.
--
-- 'creationDate', 'projectSummary_creationDate' - The date the project was created, in Unix epoch time.
--
-- 'description', 'projectSummary_description' - The project\'s description.
--
-- 'id', 'projectSummary_id' - The ID of the project.
--
-- 'name', 'projectSummary_name' - The name of the project.
newProjectSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  ProjectSummary
newProjectSummary :: Text -> Text -> ProjectSummary
newProjectSummary Text
pId_ Text
pName_ =
  ProjectSummary' :: Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Text -> Text -> ProjectSummary
ProjectSummary'
    { $sel:lastUpdateDate:ProjectSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ProjectSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ProjectSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ProjectSummary' :: Text
id = Text
pId_,
      $sel:name:ProjectSummary' :: Text
name = Text
pName_
    }

-- | The date the project was last updated, in Unix epoch time.
projectSummary_lastUpdateDate :: Lens.Lens' ProjectSummary (Prelude.Maybe Prelude.UTCTime)
projectSummary_lastUpdateDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProjectSummary -> f ProjectSummary
projectSummary_lastUpdateDate = (ProjectSummary -> Maybe POSIX)
-> (ProjectSummary -> Maybe POSIX -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSummary' {Maybe POSIX
lastUpdateDate :: Maybe POSIX
$sel:lastUpdateDate:ProjectSummary' :: ProjectSummary -> Maybe POSIX
lastUpdateDate} -> Maybe POSIX
lastUpdateDate) (\s :: ProjectSummary
s@ProjectSummary' {} Maybe POSIX
a -> ProjectSummary
s {$sel:lastUpdateDate:ProjectSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
a} :: ProjectSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProjectSummary -> f ProjectSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProjectSummary
-> f ProjectSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date the project was created, in Unix epoch time.
projectSummary_creationDate :: Lens.Lens' ProjectSummary (Prelude.Maybe Prelude.UTCTime)
projectSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProjectSummary -> f ProjectSummary
projectSummary_creationDate = (ProjectSummary -> Maybe POSIX)
-> (ProjectSummary -> Maybe POSIX -> ProjectSummary)
-> Lens ProjectSummary ProjectSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:ProjectSummary' :: ProjectSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: ProjectSummary
s@ProjectSummary' {} Maybe POSIX
a -> ProjectSummary
s {$sel:creationDate:ProjectSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: ProjectSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProjectSummary -> f ProjectSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProjectSummary
-> f ProjectSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The project\'s description.
projectSummary_description :: Lens.Lens' ProjectSummary (Prelude.Maybe Prelude.Text)
projectSummary_description :: (Maybe Text -> f (Maybe Text))
-> ProjectSummary -> f ProjectSummary
projectSummary_description = (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
description :: Maybe Text
$sel:description:ProjectSummary' :: ProjectSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: ProjectSummary
s@ProjectSummary' {} Maybe Text
a -> ProjectSummary
s {$sel:description:ProjectSummary' :: Maybe Text
description = Maybe Text
a} :: ProjectSummary)

-- | The ID of the project.
projectSummary_id :: Lens.Lens' ProjectSummary Prelude.Text
projectSummary_id :: (Text -> f Text) -> ProjectSummary -> f ProjectSummary
projectSummary_id = (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
id :: Text
$sel:id:ProjectSummary' :: ProjectSummary -> Text
id} -> Text
id) (\s :: ProjectSummary
s@ProjectSummary' {} Text
a -> ProjectSummary
s {$sel:id:ProjectSummary' :: Text
id = Text
a} :: ProjectSummary)

-- | The name of the project.
projectSummary_name :: Lens.Lens' ProjectSummary Prelude.Text
projectSummary_name :: (Text -> f Text) -> ProjectSummary -> f ProjectSummary
projectSummary_name = (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
name :: Text
$sel:name:ProjectSummary' :: ProjectSummary -> Text
name} -> Text
name) (\s :: ProjectSummary
s@ProjectSummary' {} Text
a -> ProjectSummary
s {$sel:name:ProjectSummary' :: Text
name = Text
a} :: ProjectSummary)

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 POSIX
-> Maybe POSIX -> Maybe Text -> Text -> Text -> ProjectSummary
ProjectSummary'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe Text -> Text -> Text -> ProjectSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX -> Maybe Text -> Text -> Text -> ProjectSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdateDate")
            Parser
  (Maybe POSIX -> Maybe Text -> Text -> Text -> ProjectSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Text -> Text -> ProjectSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDate")
            Parser (Maybe Text -> Text -> Text -> ProjectSummary)
-> Parser (Maybe Text) -> Parser (Text -> Text -> ProjectSummary)
forall (f :: * -> *) a b. Applicative f => 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
"description")
            Parser (Text -> Text -> ProjectSummary)
-> Parser Text -> Parser (Text -> 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
"id")
            Parser (Text -> ProjectSummary)
-> Parser Text -> Parser 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
"name")
      )

instance Prelude.Hashable ProjectSummary

instance Prelude.NFData ProjectSummary