{-# 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.WorkDocs.Types.NotificationOptions
-- 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.WorkDocs.Types.NotificationOptions where

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

-- | Set of options which defines notification preferences of given action.
--
-- /See:/ 'newNotificationOptions' smart constructor.
data NotificationOptions = NotificationOptions'
  { -- | Text value to be included in the email body.
    NotificationOptions -> Maybe (Sensitive Text)
emailMessage :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Boolean value to indicate an email notification should be sent to the
    -- receipients.
    NotificationOptions -> Maybe Bool
sendEmail :: Prelude.Maybe Prelude.Bool
  }
  deriving (NotificationOptions -> NotificationOptions -> Bool
(NotificationOptions -> NotificationOptions -> Bool)
-> (NotificationOptions -> NotificationOptions -> Bool)
-> Eq NotificationOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationOptions -> NotificationOptions -> Bool
$c/= :: NotificationOptions -> NotificationOptions -> Bool
== :: NotificationOptions -> NotificationOptions -> Bool
$c== :: NotificationOptions -> NotificationOptions -> Bool
Prelude.Eq, Int -> NotificationOptions -> ShowS
[NotificationOptions] -> ShowS
NotificationOptions -> String
(Int -> NotificationOptions -> ShowS)
-> (NotificationOptions -> String)
-> ([NotificationOptions] -> ShowS)
-> Show NotificationOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationOptions] -> ShowS
$cshowList :: [NotificationOptions] -> ShowS
show :: NotificationOptions -> String
$cshow :: NotificationOptions -> String
showsPrec :: Int -> NotificationOptions -> ShowS
$cshowsPrec :: Int -> NotificationOptions -> ShowS
Prelude.Show, (forall x. NotificationOptions -> Rep NotificationOptions x)
-> (forall x. Rep NotificationOptions x -> NotificationOptions)
-> Generic NotificationOptions
forall x. Rep NotificationOptions x -> NotificationOptions
forall x. NotificationOptions -> Rep NotificationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotificationOptions x -> NotificationOptions
$cfrom :: forall x. NotificationOptions -> Rep NotificationOptions x
Prelude.Generic)

-- |
-- Create a value of 'NotificationOptions' 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:
--
-- 'emailMessage', 'notificationOptions_emailMessage' - Text value to be included in the email body.
--
-- 'sendEmail', 'notificationOptions_sendEmail' - Boolean value to indicate an email notification should be sent to the
-- receipients.
newNotificationOptions ::
  NotificationOptions
newNotificationOptions :: NotificationOptions
newNotificationOptions =
  NotificationOptions' :: Maybe (Sensitive Text) -> Maybe Bool -> NotificationOptions
NotificationOptions'
    { $sel:emailMessage:NotificationOptions' :: Maybe (Sensitive Text)
emailMessage =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:sendEmail:NotificationOptions' :: Maybe Bool
sendEmail = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Text value to be included in the email body.
notificationOptions_emailMessage :: Lens.Lens' NotificationOptions (Prelude.Maybe Prelude.Text)
notificationOptions_emailMessage :: (Maybe Text -> f (Maybe Text))
-> NotificationOptions -> f NotificationOptions
notificationOptions_emailMessage = (NotificationOptions -> Maybe (Sensitive Text))
-> (NotificationOptions
    -> Maybe (Sensitive Text) -> NotificationOptions)
-> Lens
     NotificationOptions
     NotificationOptions
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationOptions' {Maybe (Sensitive Text)
emailMessage :: Maybe (Sensitive Text)
$sel:emailMessage:NotificationOptions' :: NotificationOptions -> Maybe (Sensitive Text)
emailMessage} -> Maybe (Sensitive Text)
emailMessage) (\s :: NotificationOptions
s@NotificationOptions' {} Maybe (Sensitive Text)
a -> NotificationOptions
s {$sel:emailMessage:NotificationOptions' :: Maybe (Sensitive Text)
emailMessage = Maybe (Sensitive Text)
a} :: NotificationOptions) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> NotificationOptions -> f NotificationOptions)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> NotificationOptions
-> f NotificationOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Boolean value to indicate an email notification should be sent to the
-- receipients.
notificationOptions_sendEmail :: Lens.Lens' NotificationOptions (Prelude.Maybe Prelude.Bool)
notificationOptions_sendEmail :: (Maybe Bool -> f (Maybe Bool))
-> NotificationOptions -> f NotificationOptions
notificationOptions_sendEmail = (NotificationOptions -> Maybe Bool)
-> (NotificationOptions -> Maybe Bool -> NotificationOptions)
-> Lens
     NotificationOptions NotificationOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationOptions' {Maybe Bool
sendEmail :: Maybe Bool
$sel:sendEmail:NotificationOptions' :: NotificationOptions -> Maybe Bool
sendEmail} -> Maybe Bool
sendEmail) (\s :: NotificationOptions
s@NotificationOptions' {} Maybe Bool
a -> NotificationOptions
s {$sel:sendEmail:NotificationOptions' :: Maybe Bool
sendEmail = Maybe Bool
a} :: NotificationOptions)

instance Prelude.Hashable NotificationOptions

instance Prelude.NFData NotificationOptions

instance Core.ToJSON NotificationOptions where
  toJSON :: NotificationOptions -> Value
toJSON NotificationOptions' {Maybe Bool
Maybe (Sensitive Text)
sendEmail :: Maybe Bool
emailMessage :: Maybe (Sensitive Text)
$sel:sendEmail:NotificationOptions' :: NotificationOptions -> Maybe Bool
$sel:emailMessage:NotificationOptions' :: NotificationOptions -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EmailMessage" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
emailMessage,
            (Text
"SendEmail" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
sendEmail
          ]
      )