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

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

-- | Contains a dashboard summary.
--
-- /See:/ 'newDashboardSummary' smart constructor.
data DashboardSummary = DashboardSummary'
  { -- | The date the dashboard was last updated, in Unix epoch time.
    DashboardSummary -> Maybe POSIX
lastUpdateDate :: Prelude.Maybe Core.POSIX,
    -- | The date the dashboard was created, in Unix epoch time.
    DashboardSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The dashboard\'s description.
    DashboardSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the dashboard.
    DashboardSummary -> Text
id :: Prelude.Text,
    -- | The name of the dashboard
    DashboardSummary -> Text
name :: Prelude.Text
  }
  deriving (DashboardSummary -> DashboardSummary -> Bool
(DashboardSummary -> DashboardSummary -> Bool)
-> (DashboardSummary -> DashboardSummary -> Bool)
-> Eq DashboardSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashboardSummary -> DashboardSummary -> Bool
$c/= :: DashboardSummary -> DashboardSummary -> Bool
== :: DashboardSummary -> DashboardSummary -> Bool
$c== :: DashboardSummary -> DashboardSummary -> Bool
Prelude.Eq, ReadPrec [DashboardSummary]
ReadPrec DashboardSummary
Int -> ReadS DashboardSummary
ReadS [DashboardSummary]
(Int -> ReadS DashboardSummary)
-> ReadS [DashboardSummary]
-> ReadPrec DashboardSummary
-> ReadPrec [DashboardSummary]
-> Read DashboardSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashboardSummary]
$creadListPrec :: ReadPrec [DashboardSummary]
readPrec :: ReadPrec DashboardSummary
$creadPrec :: ReadPrec DashboardSummary
readList :: ReadS [DashboardSummary]
$creadList :: ReadS [DashboardSummary]
readsPrec :: Int -> ReadS DashboardSummary
$creadsPrec :: Int -> ReadS DashboardSummary
Prelude.Read, Int -> DashboardSummary -> ShowS
[DashboardSummary] -> ShowS
DashboardSummary -> String
(Int -> DashboardSummary -> ShowS)
-> (DashboardSummary -> String)
-> ([DashboardSummary] -> ShowS)
-> Show DashboardSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashboardSummary] -> ShowS
$cshowList :: [DashboardSummary] -> ShowS
show :: DashboardSummary -> String
$cshow :: DashboardSummary -> String
showsPrec :: Int -> DashboardSummary -> ShowS
$cshowsPrec :: Int -> DashboardSummary -> ShowS
Prelude.Show, (forall x. DashboardSummary -> Rep DashboardSummary x)
-> (forall x. Rep DashboardSummary x -> DashboardSummary)
-> Generic DashboardSummary
forall x. Rep DashboardSummary x -> DashboardSummary
forall x. DashboardSummary -> Rep DashboardSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashboardSummary x -> DashboardSummary
$cfrom :: forall x. DashboardSummary -> Rep DashboardSummary x
Prelude.Generic)

-- |
-- Create a value of 'DashboardSummary' 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', 'dashboardSummary_lastUpdateDate' - The date the dashboard was last updated, in Unix epoch time.
--
-- 'creationDate', 'dashboardSummary_creationDate' - The date the dashboard was created, in Unix epoch time.
--
-- 'description', 'dashboardSummary_description' - The dashboard\'s description.
--
-- 'id', 'dashboardSummary_id' - The ID of the dashboard.
--
-- 'name', 'dashboardSummary_name' - The name of the dashboard
newDashboardSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  DashboardSummary
newDashboardSummary :: Text -> Text -> DashboardSummary
newDashboardSummary Text
pId_ Text
pName_ =
  DashboardSummary' :: Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Text -> Text -> DashboardSummary
DashboardSummary'
    { $sel:lastUpdateDate:DashboardSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:DashboardSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:DashboardSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DashboardSummary' :: Text
id = Text
pId_,
      $sel:name:DashboardSummary' :: Text
name = Text
pName_
    }

-- | The date the dashboard was last updated, in Unix epoch time.
dashboardSummary_lastUpdateDate :: Lens.Lens' DashboardSummary (Prelude.Maybe Prelude.UTCTime)
dashboardSummary_lastUpdateDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardSummary -> f DashboardSummary
dashboardSummary_lastUpdateDate = (DashboardSummary -> Maybe POSIX)
-> (DashboardSummary -> Maybe POSIX -> DashboardSummary)
-> Lens
     DashboardSummary DashboardSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSummary' {Maybe POSIX
lastUpdateDate :: Maybe POSIX
$sel:lastUpdateDate:DashboardSummary' :: DashboardSummary -> Maybe POSIX
lastUpdateDate} -> Maybe POSIX
lastUpdateDate) (\s :: DashboardSummary
s@DashboardSummary' {} Maybe POSIX
a -> DashboardSummary
s {$sel:lastUpdateDate:DashboardSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
a} :: DashboardSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DashboardSummary -> f DashboardSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardSummary
-> f DashboardSummary
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 dashboard was created, in Unix epoch time.
dashboardSummary_creationDate :: Lens.Lens' DashboardSummary (Prelude.Maybe Prelude.UTCTime)
dashboardSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardSummary -> f DashboardSummary
dashboardSummary_creationDate = (DashboardSummary -> Maybe POSIX)
-> (DashboardSummary -> Maybe POSIX -> DashboardSummary)
-> Lens
     DashboardSummary DashboardSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:DashboardSummary' :: DashboardSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: DashboardSummary
s@DashboardSummary' {} Maybe POSIX
a -> DashboardSummary
s {$sel:creationDate:DashboardSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: DashboardSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DashboardSummary -> f DashboardSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardSummary
-> f DashboardSummary
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 dashboard\'s description.
dashboardSummary_description :: Lens.Lens' DashboardSummary (Prelude.Maybe Prelude.Text)
dashboardSummary_description :: (Maybe Text -> f (Maybe Text))
-> DashboardSummary -> f DashboardSummary
dashboardSummary_description = (DashboardSummary -> Maybe Text)
-> (DashboardSummary -> Maybe Text -> DashboardSummary)
-> Lens DashboardSummary DashboardSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSummary' {Maybe Text
description :: Maybe Text
$sel:description:DashboardSummary' :: DashboardSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: DashboardSummary
s@DashboardSummary' {} Maybe Text
a -> DashboardSummary
s {$sel:description:DashboardSummary' :: Maybe Text
description = Maybe Text
a} :: DashboardSummary)

-- | The ID of the dashboard.
dashboardSummary_id :: Lens.Lens' DashboardSummary Prelude.Text
dashboardSummary_id :: (Text -> f Text) -> DashboardSummary -> f DashboardSummary
dashboardSummary_id = (DashboardSummary -> Text)
-> (DashboardSummary -> Text -> DashboardSummary)
-> Lens DashboardSummary DashboardSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSummary' {Text
id :: Text
$sel:id:DashboardSummary' :: DashboardSummary -> Text
id} -> Text
id) (\s :: DashboardSummary
s@DashboardSummary' {} Text
a -> DashboardSummary
s {$sel:id:DashboardSummary' :: Text
id = Text
a} :: DashboardSummary)

-- | The name of the dashboard
dashboardSummary_name :: Lens.Lens' DashboardSummary Prelude.Text
dashboardSummary_name :: (Text -> f Text) -> DashboardSummary -> f DashboardSummary
dashboardSummary_name = (DashboardSummary -> Text)
-> (DashboardSummary -> Text -> DashboardSummary)
-> Lens DashboardSummary DashboardSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSummary' {Text
name :: Text
$sel:name:DashboardSummary' :: DashboardSummary -> Text
name} -> Text
name) (\s :: DashboardSummary
s@DashboardSummary' {} Text
a -> DashboardSummary
s {$sel:name:DashboardSummary' :: Text
name = Text
a} :: DashboardSummary)

instance Core.FromJSON DashboardSummary where
  parseJSON :: Value -> Parser DashboardSummary
parseJSON =
    String
-> (Object -> Parser DashboardSummary)
-> Value
-> Parser DashboardSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DashboardSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Text -> Text -> DashboardSummary
DashboardSummary'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe Text -> Text -> Text -> DashboardSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX -> Maybe Text -> Text -> Text -> DashboardSummary)
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 -> DashboardSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Text -> Text -> DashboardSummary)
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 -> DashboardSummary)
-> Parser (Maybe Text) -> Parser (Text -> Text -> DashboardSummary)
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 -> DashboardSummary)
-> Parser Text -> Parser (Text -> DashboardSummary)
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 -> DashboardSummary)
-> Parser Text -> Parser DashboardSummary
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 DashboardSummary

instance Prelude.NFData DashboardSummary