{-# 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 #-}
module Amazonka.ChimeSDKMessaging.Types.PushNotificationPreferences where
import Amazonka.ChimeSDKMessaging.Types.AllowNotifications
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
data PushNotificationPreferences = PushNotificationPreferences'
{
PushNotificationPreferences -> Maybe (Sensitive Text)
filterRule :: Prelude.Maybe (Data.Sensitive Prelude.Text),
PushNotificationPreferences -> AllowNotifications
allowNotifications :: AllowNotifications
}
deriving (PushNotificationPreferences -> PushNotificationPreferences -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PushNotificationPreferences -> PushNotificationPreferences -> Bool
$c/= :: PushNotificationPreferences -> PushNotificationPreferences -> Bool
== :: PushNotificationPreferences -> PushNotificationPreferences -> Bool
$c== :: PushNotificationPreferences -> PushNotificationPreferences -> Bool
Prelude.Eq, Int -> PushNotificationPreferences -> ShowS
[PushNotificationPreferences] -> ShowS
PushNotificationPreferences -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PushNotificationPreferences] -> ShowS
$cshowList :: [PushNotificationPreferences] -> ShowS
show :: PushNotificationPreferences -> String
$cshow :: PushNotificationPreferences -> String
showsPrec :: Int -> PushNotificationPreferences -> ShowS
$cshowsPrec :: Int -> PushNotificationPreferences -> ShowS
Prelude.Show, forall x.
Rep PushNotificationPreferences x -> PushNotificationPreferences
forall x.
PushNotificationPreferences -> Rep PushNotificationPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PushNotificationPreferences x -> PushNotificationPreferences
$cfrom :: forall x.
PushNotificationPreferences -> Rep PushNotificationPreferences x
Prelude.Generic)
newPushNotificationPreferences ::
AllowNotifications ->
PushNotificationPreferences
newPushNotificationPreferences :: AllowNotifications -> PushNotificationPreferences
newPushNotificationPreferences AllowNotifications
pAllowNotifications_ =
PushNotificationPreferences'
{ $sel:filterRule:PushNotificationPreferences' :: Maybe (Sensitive Text)
filterRule =
forall a. Maybe a
Prelude.Nothing,
$sel:allowNotifications:PushNotificationPreferences' :: AllowNotifications
allowNotifications = AllowNotifications
pAllowNotifications_
}
pushNotificationPreferences_filterRule :: Lens.Lens' PushNotificationPreferences (Prelude.Maybe Prelude.Text)
pushNotificationPreferences_filterRule :: Lens' PushNotificationPreferences (Maybe Text)
pushNotificationPreferences_filterRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushNotificationPreferences' {Maybe (Sensitive Text)
filterRule :: Maybe (Sensitive Text)
$sel:filterRule:PushNotificationPreferences' :: PushNotificationPreferences -> Maybe (Sensitive Text)
filterRule} -> Maybe (Sensitive Text)
filterRule) (\s :: PushNotificationPreferences
s@PushNotificationPreferences' {} Maybe (Sensitive Text)
a -> PushNotificationPreferences
s {$sel:filterRule:PushNotificationPreferences' :: Maybe (Sensitive Text)
filterRule = Maybe (Sensitive Text)
a} :: PushNotificationPreferences) 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
pushNotificationPreferences_allowNotifications :: Lens.Lens' PushNotificationPreferences AllowNotifications
pushNotificationPreferences_allowNotifications :: Lens' PushNotificationPreferences AllowNotifications
pushNotificationPreferences_allowNotifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushNotificationPreferences' {AllowNotifications
allowNotifications :: AllowNotifications
$sel:allowNotifications:PushNotificationPreferences' :: PushNotificationPreferences -> AllowNotifications
allowNotifications} -> AllowNotifications
allowNotifications) (\s :: PushNotificationPreferences
s@PushNotificationPreferences' {} AllowNotifications
a -> PushNotificationPreferences
s {$sel:allowNotifications:PushNotificationPreferences' :: AllowNotifications
allowNotifications = AllowNotifications
a} :: PushNotificationPreferences)
instance Data.FromJSON PushNotificationPreferences where
parseJSON :: Value -> Parser PushNotificationPreferences
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PushNotificationPreferences"
( \Object
x ->
Maybe (Sensitive Text)
-> AllowNotifications -> PushNotificationPreferences
PushNotificationPreferences'
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
"FilterRule")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AllowNotifications")
)
instance Prelude.Hashable PushNotificationPreferences where
hashWithSalt :: Int -> PushNotificationPreferences -> Int
hashWithSalt Int
_salt PushNotificationPreferences' {Maybe (Sensitive Text)
AllowNotifications
allowNotifications :: AllowNotifications
filterRule :: Maybe (Sensitive Text)
$sel:allowNotifications:PushNotificationPreferences' :: PushNotificationPreferences -> AllowNotifications
$sel:filterRule:PushNotificationPreferences' :: PushNotificationPreferences -> Maybe (Sensitive Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
filterRule
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AllowNotifications
allowNotifications
instance Prelude.NFData PushNotificationPreferences where
rnf :: PushNotificationPreferences -> ()
rnf PushNotificationPreferences' {Maybe (Sensitive Text)
AllowNotifications
allowNotifications :: AllowNotifications
filterRule :: Maybe (Sensitive Text)
$sel:allowNotifications:PushNotificationPreferences' :: PushNotificationPreferences -> AllowNotifications
$sel:filterRule:PushNotificationPreferences' :: PushNotificationPreferences -> Maybe (Sensitive Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
filterRule
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AllowNotifications
allowNotifications
instance Data.ToJSON PushNotificationPreferences where
toJSON :: PushNotificationPreferences -> Value
toJSON PushNotificationPreferences' {Maybe (Sensitive Text)
AllowNotifications
allowNotifications :: AllowNotifications
filterRule :: Maybe (Sensitive Text)
$sel:allowNotifications:PushNotificationPreferences' :: PushNotificationPreferences -> AllowNotifications
$sel:filterRule:PushNotificationPreferences' :: PushNotificationPreferences -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"FilterRule" 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)
filterRule,
forall a. a -> Maybe a
Prelude.Just
(Key
"AllowNotifications" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AllowNotifications
allowNotifications)
]
)