{-# 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.AuditManager.Types.Notification
-- 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.AuditManager.Types.Notification 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

-- | The notification that informs a user of an update in Audit Manager. For
-- example, this includes the notification that\'s sent when a control set
-- is delegated for review.
--
-- /See:/ 'newNotification' smart constructor.
data Notification = Notification'
  { -- | The identifier for the assessment.
    Notification -> Maybe Text
assessmentId :: Prelude.Maybe Prelude.Text,
    -- | The name of the related assessment.
    Notification -> Maybe Text
assessmentName :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the control set.
    Notification -> Maybe Text
controlSetId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the control set that the notification is about.
    Notification -> Maybe Text
controlSetName :: Prelude.Maybe Prelude.Text,
    -- | The description of the notification.
    Notification -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The time when the notification was sent.
    Notification -> Maybe POSIX
eventTime :: Prelude.Maybe Data.POSIX,
    -- | The unique identifier for the notification.
    Notification -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The sender of the notification.
    Notification -> Maybe Text
source :: Prelude.Maybe Prelude.Text
  }
  deriving (Notification -> Notification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Notification -> Notification -> Bool
$c/= :: Notification -> Notification -> Bool
== :: Notification -> Notification -> Bool
$c== :: Notification -> Notification -> Bool
Prelude.Eq, ReadPrec [Notification]
ReadPrec Notification
Int -> ReadS Notification
ReadS [Notification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Notification]
$creadListPrec :: ReadPrec [Notification]
readPrec :: ReadPrec Notification
$creadPrec :: ReadPrec Notification
readList :: ReadS [Notification]
$creadList :: ReadS [Notification]
readsPrec :: Int -> ReadS Notification
$creadsPrec :: Int -> ReadS Notification
Prelude.Read, Int -> Notification -> ShowS
[Notification] -> ShowS
Notification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Notification] -> ShowS
$cshowList :: [Notification] -> ShowS
show :: Notification -> String
$cshow :: Notification -> String
showsPrec :: Int -> Notification -> ShowS
$cshowsPrec :: Int -> Notification -> ShowS
Prelude.Show, forall x. Rep Notification x -> Notification
forall x. Notification -> Rep Notification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Notification x -> Notification
$cfrom :: forall x. Notification -> Rep Notification x
Prelude.Generic)

-- |
-- Create a value of 'Notification' 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:
--
-- 'assessmentId', 'notification_assessmentId' - The identifier for the assessment.
--
-- 'assessmentName', 'notification_assessmentName' - The name of the related assessment.
--
-- 'controlSetId', 'notification_controlSetId' - The identifier for the control set.
--
-- 'controlSetName', 'notification_controlSetName' - Specifies the name of the control set that the notification is about.
--
-- 'description', 'notification_description' - The description of the notification.
--
-- 'eventTime', 'notification_eventTime' - The time when the notification was sent.
--
-- 'id', 'notification_id' - The unique identifier for the notification.
--
-- 'source', 'notification_source' - The sender of the notification.
newNotification ::
  Notification
newNotification :: Notification
newNotification =
  Notification'
    { $sel:assessmentId:Notification' :: Maybe Text
assessmentId = forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentName:Notification' :: Maybe Text
assessmentName = forall a. Maybe a
Prelude.Nothing,
      $sel:controlSetId:Notification' :: Maybe Text
controlSetId = forall a. Maybe a
Prelude.Nothing,
      $sel:controlSetName:Notification' :: Maybe Text
controlSetName = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Notification' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:eventTime:Notification' :: Maybe POSIX
eventTime = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Notification' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:source:Notification' :: Maybe Text
source = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier for the assessment.
notification_assessmentId :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_assessmentId :: Lens' Notification (Maybe Text)
notification_assessmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
assessmentId :: Maybe Text
$sel:assessmentId:Notification' :: Notification -> Maybe Text
assessmentId} -> Maybe Text
assessmentId) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:assessmentId:Notification' :: Maybe Text
assessmentId = Maybe Text
a} :: Notification)

-- | The name of the related assessment.
notification_assessmentName :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_assessmentName :: Lens' Notification (Maybe Text)
notification_assessmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
assessmentName :: Maybe Text
$sel:assessmentName:Notification' :: Notification -> Maybe Text
assessmentName} -> Maybe Text
assessmentName) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:assessmentName:Notification' :: Maybe Text
assessmentName = Maybe Text
a} :: Notification)

-- | The identifier for the control set.
notification_controlSetId :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_controlSetId :: Lens' Notification (Maybe Text)
notification_controlSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
controlSetId :: Maybe Text
$sel:controlSetId:Notification' :: Notification -> Maybe Text
controlSetId} -> Maybe Text
controlSetId) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:controlSetId:Notification' :: Maybe Text
controlSetId = Maybe Text
a} :: Notification)

-- | Specifies the name of the control set that the notification is about.
notification_controlSetName :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_controlSetName :: Lens' Notification (Maybe Text)
notification_controlSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
controlSetName :: Maybe Text
$sel:controlSetName:Notification' :: Notification -> Maybe Text
controlSetName} -> Maybe Text
controlSetName) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:controlSetName:Notification' :: Maybe Text
controlSetName = Maybe Text
a} :: Notification)

-- | The description of the notification.
notification_description :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_description :: Lens' Notification (Maybe Text)
notification_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
description :: Maybe Text
$sel:description:Notification' :: Notification -> Maybe Text
description} -> Maybe Text
description) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:description:Notification' :: Maybe Text
description = Maybe Text
a} :: Notification)

-- | The time when the notification was sent.
notification_eventTime :: Lens.Lens' Notification (Prelude.Maybe Prelude.UTCTime)
notification_eventTime :: Lens' Notification (Maybe UTCTime)
notification_eventTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe POSIX
eventTime :: Maybe POSIX
$sel:eventTime:Notification' :: Notification -> Maybe POSIX
eventTime} -> Maybe POSIX
eventTime) (\s :: Notification
s@Notification' {} Maybe POSIX
a -> Notification
s {$sel:eventTime:Notification' :: Maybe POSIX
eventTime = Maybe POSIX
a} :: Notification) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique identifier for the notification.
notification_id :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_id :: Lens' Notification (Maybe Text)
notification_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
id :: Maybe Text
$sel:id:Notification' :: Notification -> Maybe Text
id} -> Maybe Text
id) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:id:Notification' :: Maybe Text
id = Maybe Text
a} :: Notification)

-- | The sender of the notification.
notification_source :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_source :: Lens' Notification (Maybe Text)
notification_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
source :: Maybe Text
$sel:source:Notification' :: Notification -> Maybe Text
source} -> Maybe Text
source) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:source:Notification' :: Maybe Text
source = Maybe Text
a} :: Notification)

instance Data.FromJSON Notification where
  parseJSON :: Value -> Parser Notification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Notification"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Notification
Notification'
            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
"assessmentId")
            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
"assessmentName")
            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
"controlSetId")
            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
"controlSetName")
            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
"description")
            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
"eventTime")
            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
"id")
            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
"source")
      )

instance Prelude.Hashable Notification where
  hashWithSalt :: Int -> Notification -> Int
hashWithSalt Int
_salt Notification' {Maybe Text
Maybe POSIX
source :: Maybe Text
id :: Maybe Text
eventTime :: Maybe POSIX
description :: Maybe Text
controlSetName :: Maybe Text
controlSetId :: Maybe Text
assessmentName :: Maybe Text
assessmentId :: Maybe Text
$sel:source:Notification' :: Notification -> Maybe Text
$sel:id:Notification' :: Notification -> Maybe Text
$sel:eventTime:Notification' :: Notification -> Maybe POSIX
$sel:description:Notification' :: Notification -> Maybe Text
$sel:controlSetName:Notification' :: Notification -> Maybe Text
$sel:controlSetId:Notification' :: Notification -> Maybe Text
$sel:assessmentName:Notification' :: Notification -> Maybe Text
$sel:assessmentId:Notification' :: Notification -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
assessmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
assessmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
controlSetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
controlSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
eventTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
source

instance Prelude.NFData Notification where
  rnf :: Notification -> ()
rnf Notification' {Maybe Text
Maybe POSIX
source :: Maybe Text
id :: Maybe Text
eventTime :: Maybe POSIX
description :: Maybe Text
controlSetName :: Maybe Text
controlSetId :: Maybe Text
assessmentName :: Maybe Text
assessmentId :: Maybe Text
$sel:source:Notification' :: Notification -> Maybe Text
$sel:id:Notification' :: Notification -> Maybe Text
$sel:eventTime:Notification' :: Notification -> Maybe POSIX
$sel:description:Notification' :: Notification -> Maybe Text
$sel:controlSetName:Notification' :: Notification -> Maybe Text
$sel:controlSetId:Notification' :: Notification -> Maybe Text
$sel:assessmentName:Notification' :: Notification -> Maybe Text
$sel:assessmentId:Notification' :: Notification -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
assessmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
assessmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
controlSetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
controlSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
eventTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
source