{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WorkDocs.Types.NotificationOptions 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

-- | 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 (Data.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
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
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. 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'
    { $sel:emailMessage:NotificationOptions' :: Maybe (Sensitive Text)
emailMessage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sendEmail:NotificationOptions' :: Maybe Bool
sendEmail = 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 :: Lens' NotificationOptions (Maybe Text)
notificationOptions_emailMessage = 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) 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. Iso' (Sensitive a) a
Data._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 :: Lens' NotificationOptions (Maybe Bool)
notificationOptions_sendEmail = 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 where
  hashWithSalt :: Int -> NotificationOptions -> Int
hashWithSalt Int
_salt 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)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
emailMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
sendEmail

instance Prelude.NFData NotificationOptions where
  rnf :: NotificationOptions -> ()
rnf 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)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
emailMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
sendEmail

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EmailMessage" 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 (Sensitive Text)
emailMessage,
            (Key
"SendEmail" 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 Bool
sendEmail
          ]
      )