{-# 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.Glue.Types.NotificationProperty
-- 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.Glue.Types.NotificationProperty 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

-- | Specifies configuration properties of a notification.
--
-- /See:/ 'newNotificationProperty' smart constructor.
data NotificationProperty = NotificationProperty'
  { -- | After a job run starts, the number of minutes to wait before sending a
    -- job run delay notification.
    NotificationProperty -> Maybe Natural
notifyDelayAfter :: Prelude.Maybe Prelude.Natural
  }
  deriving (NotificationProperty -> NotificationProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationProperty -> NotificationProperty -> Bool
$c/= :: NotificationProperty -> NotificationProperty -> Bool
== :: NotificationProperty -> NotificationProperty -> Bool
$c== :: NotificationProperty -> NotificationProperty -> Bool
Prelude.Eq, ReadPrec [NotificationProperty]
ReadPrec NotificationProperty
Int -> ReadS NotificationProperty
ReadS [NotificationProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotificationProperty]
$creadListPrec :: ReadPrec [NotificationProperty]
readPrec :: ReadPrec NotificationProperty
$creadPrec :: ReadPrec NotificationProperty
readList :: ReadS [NotificationProperty]
$creadList :: ReadS [NotificationProperty]
readsPrec :: Int -> ReadS NotificationProperty
$creadsPrec :: Int -> ReadS NotificationProperty
Prelude.Read, Int -> NotificationProperty -> ShowS
[NotificationProperty] -> ShowS
NotificationProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationProperty] -> ShowS
$cshowList :: [NotificationProperty] -> ShowS
show :: NotificationProperty -> String
$cshow :: NotificationProperty -> String
showsPrec :: Int -> NotificationProperty -> ShowS
$cshowsPrec :: Int -> NotificationProperty -> ShowS
Prelude.Show, forall x. Rep NotificationProperty x -> NotificationProperty
forall x. NotificationProperty -> Rep NotificationProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotificationProperty x -> NotificationProperty
$cfrom :: forall x. NotificationProperty -> Rep NotificationProperty x
Prelude.Generic)

-- |
-- Create a value of 'NotificationProperty' 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:
--
-- 'notifyDelayAfter', 'notificationProperty_notifyDelayAfter' - After a job run starts, the number of minutes to wait before sending a
-- job run delay notification.
newNotificationProperty ::
  NotificationProperty
newNotificationProperty :: NotificationProperty
newNotificationProperty =
  NotificationProperty'
    { $sel:notifyDelayAfter:NotificationProperty' :: Maybe Natural
notifyDelayAfter =
        forall a. Maybe a
Prelude.Nothing
    }

-- | After a job run starts, the number of minutes to wait before sending a
-- job run delay notification.
notificationProperty_notifyDelayAfter :: Lens.Lens' NotificationProperty (Prelude.Maybe Prelude.Natural)
notificationProperty_notifyDelayAfter :: Lens' NotificationProperty (Maybe Natural)
notificationProperty_notifyDelayAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationProperty' {Maybe Natural
notifyDelayAfter :: Maybe Natural
$sel:notifyDelayAfter:NotificationProperty' :: NotificationProperty -> Maybe Natural
notifyDelayAfter} -> Maybe Natural
notifyDelayAfter) (\s :: NotificationProperty
s@NotificationProperty' {} Maybe Natural
a -> NotificationProperty
s {$sel:notifyDelayAfter:NotificationProperty' :: Maybe Natural
notifyDelayAfter = Maybe Natural
a} :: NotificationProperty)

instance Data.FromJSON NotificationProperty where
  parseJSON :: Value -> Parser NotificationProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NotificationProperty"
      ( \Object
x ->
          Maybe Natural -> NotificationProperty
NotificationProperty'
            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
"NotifyDelayAfter")
      )

instance Prelude.Hashable NotificationProperty where
  hashWithSalt :: Int -> NotificationProperty -> Int
hashWithSalt Int
_salt NotificationProperty' {Maybe Natural
notifyDelayAfter :: Maybe Natural
$sel:notifyDelayAfter:NotificationProperty' :: NotificationProperty -> Maybe Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
notifyDelayAfter

instance Prelude.NFData NotificationProperty where
  rnf :: NotificationProperty -> ()
rnf NotificationProperty' {Maybe Natural
notifyDelayAfter :: Maybe Natural
$sel:notifyDelayAfter:NotificationProperty' :: NotificationProperty -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
notifyDelayAfter

instance Data.ToJSON NotificationProperty where
  toJSON :: NotificationProperty -> Value
toJSON NotificationProperty' {Maybe Natural
notifyDelayAfter :: Maybe Natural
$sel:notifyDelayAfter:NotificationProperty' :: NotificationProperty -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"NotifyDelayAfter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
notifyDelayAfter
          ]
      )