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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(NotificationProperty -> NotificationProperty -> Bool)
-> (NotificationProperty -> NotificationProperty -> Bool)
-> Eq NotificationProperty
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]
(Int -> ReadS NotificationProperty)
-> ReadS [NotificationProperty]
-> ReadPrec NotificationProperty
-> ReadPrec [NotificationProperty]
-> Read 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
(Int -> NotificationProperty -> ShowS)
-> (NotificationProperty -> String)
-> ([NotificationProperty] -> ShowS)
-> Show NotificationProperty
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. NotificationProperty -> Rep NotificationProperty x)
-> (forall x. Rep NotificationProperty x -> NotificationProperty)
-> Generic NotificationProperty
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' :: Maybe Natural -> NotificationProperty
NotificationProperty'
    { $sel:notifyDelayAfter:NotificationProperty' :: Maybe Natural
notifyDelayAfter =
        Maybe Natural
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 :: (Maybe Natural -> f (Maybe Natural))
-> NotificationProperty -> f NotificationProperty
notificationProperty_notifyDelayAfter = (NotificationProperty -> Maybe Natural)
-> (NotificationProperty -> Maybe Natural -> NotificationProperty)
-> Lens
     NotificationProperty
     NotificationProperty
     (Maybe Natural)
     (Maybe Natural)
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 Core.FromJSON NotificationProperty where
  parseJSON :: Value -> Parser NotificationProperty
parseJSON =
    String
-> (Object -> Parser NotificationProperty)
-> Value
-> Parser NotificationProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NotificationProperty"
      ( \Object
x ->
          Maybe Natural -> NotificationProperty
NotificationProperty'
            (Maybe Natural -> NotificationProperty)
-> Parser (Maybe Natural) -> Parser NotificationProperty
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NotifyDelayAfter")
      )

instance Prelude.Hashable NotificationProperty

instance Prelude.NFData NotificationProperty

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