{-# 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.ElasticTranscoder.Types.Notifications
-- 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.ElasticTranscoder.Types.Notifications 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 Amazon Simple Notification Service (Amazon SNS) topic or topics to
-- notify in order to report job status.
--
-- To receive notifications, you must also subscribe to the new topic in
-- the Amazon SNS console.
--
-- /See:/ 'newNotifications' smart constructor.
data Notifications = Notifications'
  { -- | The Amazon SNS topic that you want to notify when Elastic Transcoder has
    -- finished processing the job.
    Notifications -> Maybe Text
completed :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SNS topic that you want to notify when Elastic Transcoder
    -- encounters an error condition.
    Notifications -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Simple Notification Service (Amazon SNS) topic that you want
    -- to notify when Elastic Transcoder has started to process the job.
    Notifications -> Maybe Text
progressing :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SNS topic that you want to notify when Elastic Transcoder
    -- encounters a warning condition.
    Notifications -> Maybe Text
warning :: Prelude.Maybe Prelude.Text
  }
  deriving (Notifications -> Notifications -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Notifications -> Notifications -> Bool
$c/= :: Notifications -> Notifications -> Bool
== :: Notifications -> Notifications -> Bool
$c== :: Notifications -> Notifications -> Bool
Prelude.Eq, ReadPrec [Notifications]
ReadPrec Notifications
Int -> ReadS Notifications
ReadS [Notifications]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Notifications]
$creadListPrec :: ReadPrec [Notifications]
readPrec :: ReadPrec Notifications
$creadPrec :: ReadPrec Notifications
readList :: ReadS [Notifications]
$creadList :: ReadS [Notifications]
readsPrec :: Int -> ReadS Notifications
$creadsPrec :: Int -> ReadS Notifications
Prelude.Read, Int -> Notifications -> ShowS
[Notifications] -> ShowS
Notifications -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Notifications] -> ShowS
$cshowList :: [Notifications] -> ShowS
show :: Notifications -> String
$cshow :: Notifications -> String
showsPrec :: Int -> Notifications -> ShowS
$cshowsPrec :: Int -> Notifications -> ShowS
Prelude.Show, forall x. Rep Notifications x -> Notifications
forall x. Notifications -> Rep Notifications x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Notifications x -> Notifications
$cfrom :: forall x. Notifications -> Rep Notifications x
Prelude.Generic)

-- |
-- Create a value of 'Notifications' 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:
--
-- 'completed', 'notifications_completed' - The Amazon SNS topic that you want to notify when Elastic Transcoder has
-- finished processing the job.
--
-- 'error', 'notifications_error' - The Amazon SNS topic that you want to notify when Elastic Transcoder
-- encounters an error condition.
--
-- 'progressing', 'notifications_progressing' - The Amazon Simple Notification Service (Amazon SNS) topic that you want
-- to notify when Elastic Transcoder has started to process the job.
--
-- 'warning', 'notifications_warning' - The Amazon SNS topic that you want to notify when Elastic Transcoder
-- encounters a warning condition.
newNotifications ::
  Notifications
newNotifications :: Notifications
newNotifications =
  Notifications'
    { $sel:completed:Notifications' :: Maybe Text
completed = forall a. Maybe a
Prelude.Nothing,
      $sel:error:Notifications' :: Maybe Text
error = forall a. Maybe a
Prelude.Nothing,
      $sel:progressing:Notifications' :: Maybe Text
progressing = forall a. Maybe a
Prelude.Nothing,
      $sel:warning:Notifications' :: Maybe Text
warning = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon SNS topic that you want to notify when Elastic Transcoder has
-- finished processing the job.
notifications_completed :: Lens.Lens' Notifications (Prelude.Maybe Prelude.Text)
notifications_completed :: Lens' Notifications (Maybe Text)
notifications_completed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notifications' {Maybe Text
completed :: Maybe Text
$sel:completed:Notifications' :: Notifications -> Maybe Text
completed} -> Maybe Text
completed) (\s :: Notifications
s@Notifications' {} Maybe Text
a -> Notifications
s {$sel:completed:Notifications' :: Maybe Text
completed = Maybe Text
a} :: Notifications)

-- | The Amazon SNS topic that you want to notify when Elastic Transcoder
-- encounters an error condition.
notifications_error :: Lens.Lens' Notifications (Prelude.Maybe Prelude.Text)
notifications_error :: Lens' Notifications (Maybe Text)
notifications_error = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notifications' {Maybe Text
error :: Maybe Text
$sel:error:Notifications' :: Notifications -> Maybe Text
error} -> Maybe Text
error) (\s :: Notifications
s@Notifications' {} Maybe Text
a -> Notifications
s {$sel:error:Notifications' :: Maybe Text
error = Maybe Text
a} :: Notifications)

-- | The Amazon Simple Notification Service (Amazon SNS) topic that you want
-- to notify when Elastic Transcoder has started to process the job.
notifications_progressing :: Lens.Lens' Notifications (Prelude.Maybe Prelude.Text)
notifications_progressing :: Lens' Notifications (Maybe Text)
notifications_progressing = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notifications' {Maybe Text
progressing :: Maybe Text
$sel:progressing:Notifications' :: Notifications -> Maybe Text
progressing} -> Maybe Text
progressing) (\s :: Notifications
s@Notifications' {} Maybe Text
a -> Notifications
s {$sel:progressing:Notifications' :: Maybe Text
progressing = Maybe Text
a} :: Notifications)

-- | The Amazon SNS topic that you want to notify when Elastic Transcoder
-- encounters a warning condition.
notifications_warning :: Lens.Lens' Notifications (Prelude.Maybe Prelude.Text)
notifications_warning :: Lens' Notifications (Maybe Text)
notifications_warning = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notifications' {Maybe Text
warning :: Maybe Text
$sel:warning:Notifications' :: Notifications -> Maybe Text
warning} -> Maybe Text
warning) (\s :: Notifications
s@Notifications' {} Maybe Text
a -> Notifications
s {$sel:warning:Notifications' :: Maybe Text
warning = Maybe Text
a} :: Notifications)

instance Data.FromJSON Notifications where
  parseJSON :: Value -> Parser Notifications
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Notifications"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Notifications
Notifications'
            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
"Completed")
            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
"Error")
            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
"Progressing")
            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
"Warning")
      )

instance Prelude.Hashable Notifications where
  hashWithSalt :: Int -> Notifications -> Int
hashWithSalt Int
_salt Notifications' {Maybe Text
warning :: Maybe Text
progressing :: Maybe Text
error :: Maybe Text
completed :: Maybe Text
$sel:warning:Notifications' :: Notifications -> Maybe Text
$sel:progressing:Notifications' :: Notifications -> Maybe Text
$sel:error:Notifications' :: Notifications -> Maybe Text
$sel:completed:Notifications' :: Notifications -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
completed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
error
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
progressing
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
warning

instance Prelude.NFData Notifications where
  rnf :: Notifications -> ()
rnf Notifications' {Maybe Text
warning :: Maybe Text
progressing :: Maybe Text
error :: Maybe Text
completed :: Maybe Text
$sel:warning:Notifications' :: Notifications -> Maybe Text
$sel:progressing:Notifications' :: Notifications -> Maybe Text
$sel:error:Notifications' :: Notifications -> Maybe Text
$sel:completed:Notifications' :: Notifications -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
completed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
error
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
progressing
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
warning

instance Data.ToJSON Notifications where
  toJSON :: Notifications -> Value
toJSON Notifications' {Maybe Text
warning :: Maybe Text
progressing :: Maybe Text
error :: Maybe Text
completed :: Maybe Text
$sel:warning:Notifications' :: Notifications -> Maybe Text
$sel:progressing:Notifications' :: Notifications -> Maybe Text
$sel:error:Notifications' :: Notifications -> Maybe Text
$sel:completed:Notifications' :: Notifications -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Completed" 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 Text
completed,
            (Key
"Error" 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 Text
error,
            (Key
"Progressing" 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 Text
progressing,
            (Key
"Warning" 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 Text
warning
          ]
      )