{-# 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.PlacementSummary
-- 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.PlacementSummary 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 placement.
--
-- /See:/ 'newPlacementSummary' smart constructor.
data PlacementSummary = PlacementSummary'
  { -- | The name of the project containing the placement.
    PlacementSummary -> Text
projectName :: Prelude.Text,
    -- | The name of the placement being summarized.
    PlacementSummary -> Text
placementName :: Prelude.Text,
    -- | The date when the placement was originally created, in UNIX epoch time
    -- format.
    PlacementSummary -> POSIX
createdDate :: Core.POSIX,
    -- | The date when the placement was last updated, in UNIX epoch time format.
    -- If the placement was not updated, then @createdDate@ and @updatedDate@
    -- are the same.
    PlacementSummary -> POSIX
updatedDate :: Core.POSIX
  }
  deriving (PlacementSummary -> PlacementSummary -> Bool
(PlacementSummary -> PlacementSummary -> Bool)
-> (PlacementSummary -> PlacementSummary -> Bool)
-> Eq PlacementSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlacementSummary -> PlacementSummary -> Bool
$c/= :: PlacementSummary -> PlacementSummary -> Bool
== :: PlacementSummary -> PlacementSummary -> Bool
$c== :: PlacementSummary -> PlacementSummary -> Bool
Prelude.Eq, ReadPrec [PlacementSummary]
ReadPrec PlacementSummary
Int -> ReadS PlacementSummary
ReadS [PlacementSummary]
(Int -> ReadS PlacementSummary)
-> ReadS [PlacementSummary]
-> ReadPrec PlacementSummary
-> ReadPrec [PlacementSummary]
-> Read PlacementSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlacementSummary]
$creadListPrec :: ReadPrec [PlacementSummary]
readPrec :: ReadPrec PlacementSummary
$creadPrec :: ReadPrec PlacementSummary
readList :: ReadS [PlacementSummary]
$creadList :: ReadS [PlacementSummary]
readsPrec :: Int -> ReadS PlacementSummary
$creadsPrec :: Int -> ReadS PlacementSummary
Prelude.Read, Int -> PlacementSummary -> ShowS
[PlacementSummary] -> ShowS
PlacementSummary -> String
(Int -> PlacementSummary -> ShowS)
-> (PlacementSummary -> String)
-> ([PlacementSummary] -> ShowS)
-> Show PlacementSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlacementSummary] -> ShowS
$cshowList :: [PlacementSummary] -> ShowS
show :: PlacementSummary -> String
$cshow :: PlacementSummary -> String
showsPrec :: Int -> PlacementSummary -> ShowS
$cshowsPrec :: Int -> PlacementSummary -> ShowS
Prelude.Show, (forall x. PlacementSummary -> Rep PlacementSummary x)
-> (forall x. Rep PlacementSummary x -> PlacementSummary)
-> Generic PlacementSummary
forall x. Rep PlacementSummary x -> PlacementSummary
forall x. PlacementSummary -> Rep PlacementSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlacementSummary x -> PlacementSummary
$cfrom :: forall x. PlacementSummary -> Rep PlacementSummary x
Prelude.Generic)

-- |
-- Create a value of 'PlacementSummary' 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:
--
-- 'projectName', 'placementSummary_projectName' - The name of the project containing the placement.
--
-- 'placementName', 'placementSummary_placementName' - The name of the placement being summarized.
--
-- 'createdDate', 'placementSummary_createdDate' - The date when the placement was originally created, in UNIX epoch time
-- format.
--
-- 'updatedDate', 'placementSummary_updatedDate' - The date when the placement was last updated, in UNIX epoch time format.
-- If the placement was not updated, then @createdDate@ and @updatedDate@
-- are the same.
newPlacementSummary ::
  -- | 'projectName'
  Prelude.Text ->
  -- | 'placementName'
  Prelude.Text ->
  -- | 'createdDate'
  Prelude.UTCTime ->
  -- | 'updatedDate'
  Prelude.UTCTime ->
  PlacementSummary
newPlacementSummary :: Text -> Text -> UTCTime -> UTCTime -> PlacementSummary
newPlacementSummary
  Text
pProjectName_
  Text
pPlacementName_
  UTCTime
pCreatedDate_
  UTCTime
pUpdatedDate_ =
    PlacementSummary' :: Text -> Text -> POSIX -> POSIX -> PlacementSummary
PlacementSummary'
      { $sel:projectName:PlacementSummary' :: Text
projectName = Text
pProjectName_,
        $sel:placementName:PlacementSummary' :: Text
placementName = Text
pPlacementName_,
        $sel:createdDate:PlacementSummary' :: 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:PlacementSummary' :: 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 name of the project containing the placement.
placementSummary_projectName :: Lens.Lens' PlacementSummary Prelude.Text
placementSummary_projectName :: (Text -> f Text) -> PlacementSummary -> f PlacementSummary
placementSummary_projectName = (PlacementSummary -> Text)
-> (PlacementSummary -> Text -> PlacementSummary)
-> Lens PlacementSummary PlacementSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementSummary' {Text
projectName :: Text
$sel:projectName:PlacementSummary' :: PlacementSummary -> Text
projectName} -> Text
projectName) (\s :: PlacementSummary
s@PlacementSummary' {} Text
a -> PlacementSummary
s {$sel:projectName:PlacementSummary' :: Text
projectName = Text
a} :: PlacementSummary)

-- | The name of the placement being summarized.
placementSummary_placementName :: Lens.Lens' PlacementSummary Prelude.Text
placementSummary_placementName :: (Text -> f Text) -> PlacementSummary -> f PlacementSummary
placementSummary_placementName = (PlacementSummary -> Text)
-> (PlacementSummary -> Text -> PlacementSummary)
-> Lens PlacementSummary PlacementSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementSummary' {Text
placementName :: Text
$sel:placementName:PlacementSummary' :: PlacementSummary -> Text
placementName} -> Text
placementName) (\s :: PlacementSummary
s@PlacementSummary' {} Text
a -> PlacementSummary
s {$sel:placementName:PlacementSummary' :: Text
placementName = Text
a} :: PlacementSummary)

-- | The date when the placement was originally created, in UNIX epoch time
-- format.
placementSummary_createdDate :: Lens.Lens' PlacementSummary Prelude.UTCTime
placementSummary_createdDate :: (UTCTime -> f UTCTime) -> PlacementSummary -> f PlacementSummary
placementSummary_createdDate = (PlacementSummary -> POSIX)
-> (PlacementSummary -> POSIX -> PlacementSummary)
-> Lens PlacementSummary PlacementSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementSummary' {POSIX
createdDate :: POSIX
$sel:createdDate:PlacementSummary' :: PlacementSummary -> POSIX
createdDate} -> POSIX
createdDate) (\s :: PlacementSummary
s@PlacementSummary' {} POSIX
a -> PlacementSummary
s {$sel:createdDate:PlacementSummary' :: POSIX
createdDate = POSIX
a} :: PlacementSummary) ((POSIX -> f POSIX) -> PlacementSummary -> f PlacementSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PlacementSummary
-> f PlacementSummary
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 placement was last updated, in UNIX epoch time format.
-- If the placement was not updated, then @createdDate@ and @updatedDate@
-- are the same.
placementSummary_updatedDate :: Lens.Lens' PlacementSummary Prelude.UTCTime
placementSummary_updatedDate :: (UTCTime -> f UTCTime) -> PlacementSummary -> f PlacementSummary
placementSummary_updatedDate = (PlacementSummary -> POSIX)
-> (PlacementSummary -> POSIX -> PlacementSummary)
-> Lens PlacementSummary PlacementSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementSummary' {POSIX
updatedDate :: POSIX
$sel:updatedDate:PlacementSummary' :: PlacementSummary -> POSIX
updatedDate} -> POSIX
updatedDate) (\s :: PlacementSummary
s@PlacementSummary' {} POSIX
a -> PlacementSummary
s {$sel:updatedDate:PlacementSummary' :: POSIX
updatedDate = POSIX
a} :: PlacementSummary) ((POSIX -> f POSIX) -> PlacementSummary -> f PlacementSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PlacementSummary
-> f PlacementSummary
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 PlacementSummary where
  parseJSON :: Value -> Parser PlacementSummary
parseJSON =
    String
-> (Object -> Parser PlacementSummary)
-> Value
-> Parser PlacementSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlacementSummary"
      ( \Object
x ->
          Text -> Text -> POSIX -> POSIX -> PlacementSummary
PlacementSummary'
            (Text -> Text -> POSIX -> POSIX -> PlacementSummary)
-> Parser Text
-> Parser (Text -> POSIX -> POSIX -> PlacementSummary)
forall (f :: * -> *) a b. Functor 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 (Text -> POSIX -> POSIX -> PlacementSummary)
-> Parser Text -> Parser (POSIX -> POSIX -> PlacementSummary)
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
"placementName")
            Parser (POSIX -> POSIX -> PlacementSummary)
-> Parser POSIX -> Parser (POSIX -> PlacementSummary)
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 -> PlacementSummary)
-> Parser POSIX -> Parser PlacementSummary
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 PlacementSummary

instance Prelude.NFData PlacementSummary