{-# 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.ChimeSDKMessaging.Types.PushNotificationConfiguration
-- 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.ChimeSDKMessaging.Types.PushNotificationConfiguration where

import Amazonka.ChimeSDKMessaging.Types.PushNotificationType
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 push notification configuration of the message.
--
-- /See:/ 'newPushNotificationConfiguration' smart constructor.
data PushNotificationConfiguration = PushNotificationConfiguration'
  { -- | The body of the push notification.
    PushNotificationConfiguration -> Maybe (Sensitive Text)
body :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The title of the push notification.
    PushNotificationConfiguration -> Maybe (Sensitive Text)
title :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Enum value that indicates the type of the push notification for a
    -- message. @DEFAULT@: Normal mobile push notification. @VOIP@: VOIP mobile
    -- push notification.
    PushNotificationConfiguration -> Maybe PushNotificationType
type' :: Prelude.Maybe PushNotificationType
  }
  deriving (PushNotificationConfiguration
-> PushNotificationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PushNotificationConfiguration
-> PushNotificationConfiguration -> Bool
$c/= :: PushNotificationConfiguration
-> PushNotificationConfiguration -> Bool
== :: PushNotificationConfiguration
-> PushNotificationConfiguration -> Bool
$c== :: PushNotificationConfiguration
-> PushNotificationConfiguration -> Bool
Prelude.Eq, Int -> PushNotificationConfiguration -> ShowS
[PushNotificationConfiguration] -> ShowS
PushNotificationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PushNotificationConfiguration] -> ShowS
$cshowList :: [PushNotificationConfiguration] -> ShowS
show :: PushNotificationConfiguration -> String
$cshow :: PushNotificationConfiguration -> String
showsPrec :: Int -> PushNotificationConfiguration -> ShowS
$cshowsPrec :: Int -> PushNotificationConfiguration -> ShowS
Prelude.Show, forall x.
Rep PushNotificationConfiguration x
-> PushNotificationConfiguration
forall x.
PushNotificationConfiguration
-> Rep PushNotificationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PushNotificationConfiguration x
-> PushNotificationConfiguration
$cfrom :: forall x.
PushNotificationConfiguration
-> Rep PushNotificationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PushNotificationConfiguration' 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:
--
-- 'body', 'pushNotificationConfiguration_body' - The body of the push notification.
--
-- 'title', 'pushNotificationConfiguration_title' - The title of the push notification.
--
-- 'type'', 'pushNotificationConfiguration_type' - Enum value that indicates the type of the push notification for a
-- message. @DEFAULT@: Normal mobile push notification. @VOIP@: VOIP mobile
-- push notification.
newPushNotificationConfiguration ::
  PushNotificationConfiguration
newPushNotificationConfiguration :: PushNotificationConfiguration
newPushNotificationConfiguration =
  PushNotificationConfiguration'
    { $sel:body:PushNotificationConfiguration' :: Maybe (Sensitive Text)
body =
        forall a. Maybe a
Prelude.Nothing,
      $sel:title:PushNotificationConfiguration' :: Maybe (Sensitive Text)
title = forall a. Maybe a
Prelude.Nothing,
      $sel:type':PushNotificationConfiguration' :: Maybe PushNotificationType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The body of the push notification.
pushNotificationConfiguration_body :: Lens.Lens' PushNotificationConfiguration (Prelude.Maybe Prelude.Text)
pushNotificationConfiguration_body :: Lens' PushNotificationConfiguration (Maybe Text)
pushNotificationConfiguration_body = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushNotificationConfiguration' {Maybe (Sensitive Text)
body :: Maybe (Sensitive Text)
$sel:body:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
body} -> Maybe (Sensitive Text)
body) (\s :: PushNotificationConfiguration
s@PushNotificationConfiguration' {} Maybe (Sensitive Text)
a -> PushNotificationConfiguration
s {$sel:body:PushNotificationConfiguration' :: Maybe (Sensitive Text)
body = Maybe (Sensitive Text)
a} :: PushNotificationConfiguration) 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

-- | The title of the push notification.
pushNotificationConfiguration_title :: Lens.Lens' PushNotificationConfiguration (Prelude.Maybe Prelude.Text)
pushNotificationConfiguration_title :: Lens' PushNotificationConfiguration (Maybe Text)
pushNotificationConfiguration_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushNotificationConfiguration' {Maybe (Sensitive Text)
title :: Maybe (Sensitive Text)
$sel:title:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
title} -> Maybe (Sensitive Text)
title) (\s :: PushNotificationConfiguration
s@PushNotificationConfiguration' {} Maybe (Sensitive Text)
a -> PushNotificationConfiguration
s {$sel:title:PushNotificationConfiguration' :: Maybe (Sensitive Text)
title = Maybe (Sensitive Text)
a} :: PushNotificationConfiguration) 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

-- | Enum value that indicates the type of the push notification for a
-- message. @DEFAULT@: Normal mobile push notification. @VOIP@: VOIP mobile
-- push notification.
pushNotificationConfiguration_type :: Lens.Lens' PushNotificationConfiguration (Prelude.Maybe PushNotificationType)
pushNotificationConfiguration_type :: Lens' PushNotificationConfiguration (Maybe PushNotificationType)
pushNotificationConfiguration_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushNotificationConfiguration' {Maybe PushNotificationType
type' :: Maybe PushNotificationType
$sel:type':PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe PushNotificationType
type'} -> Maybe PushNotificationType
type') (\s :: PushNotificationConfiguration
s@PushNotificationConfiguration' {} Maybe PushNotificationType
a -> PushNotificationConfiguration
s {$sel:type':PushNotificationConfiguration' :: Maybe PushNotificationType
type' = Maybe PushNotificationType
a} :: PushNotificationConfiguration)

instance
  Prelude.Hashable
    PushNotificationConfiguration
  where
  hashWithSalt :: Int -> PushNotificationConfiguration -> Int
hashWithSalt Int
_salt PushNotificationConfiguration' {Maybe (Sensitive Text)
Maybe PushNotificationType
type' :: Maybe PushNotificationType
title :: Maybe (Sensitive Text)
body :: Maybe (Sensitive Text)
$sel:type':PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe PushNotificationType
$sel:title:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
$sel:body:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
body
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PushNotificationType
type'

instance Prelude.NFData PushNotificationConfiguration where
  rnf :: PushNotificationConfiguration -> ()
rnf PushNotificationConfiguration' {Maybe (Sensitive Text)
Maybe PushNotificationType
type' :: Maybe PushNotificationType
title :: Maybe (Sensitive Text)
body :: Maybe (Sensitive Text)
$sel:type':PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe PushNotificationType
$sel:title:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
$sel:body:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
body
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PushNotificationType
type'

instance Data.ToJSON PushNotificationConfiguration where
  toJSON :: PushNotificationConfiguration -> Value
toJSON PushNotificationConfiguration' {Maybe (Sensitive Text)
Maybe PushNotificationType
type' :: Maybe PushNotificationType
title :: Maybe (Sensitive Text)
body :: Maybe (Sensitive Text)
$sel:type':PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe PushNotificationType
$sel:title:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
$sel:body:PushNotificationConfiguration' :: PushNotificationConfiguration -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Body" 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)
body,
            (Key
"Title" 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)
title,
            (Key
"Type" 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 PushNotificationType
type'
          ]
      )