{-# 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.Pinpoint.Types.APNSMessage
-- 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.Pinpoint.Types.APNSMessage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Action
import qualified Amazonka.Prelude as Prelude

-- | Specifies the settings for a one-time message that\'s sent directly to
-- an endpoint through the APNs (Apple Push Notification service) channel.
--
-- /See:/ 'newAPNSMessage' smart constructor.
data APNSMessage = APNSMessage'
  { -- | The default message variables to use in the notification message. You
    -- can override these default variables with individual address variables.
    APNSMessage -> Maybe (HashMap Text [Text])
substitutions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | Specifies whether the notification is a silent push notification. A
    -- silent (or background) push notification isn\'t displayed on
    -- recipients\' devices. You can use silent push notifications to make
    -- small updates to your app, or to display messages in an in-app message
    -- center.
    --
    -- Amazon Pinpoint uses this property to determine the correct value for
    -- the apns-push-type request header when it sends the notification message
    -- to APNs. If you specify a value of true for this property, Amazon
    -- Pinpoint sets the value for the apns-push-type header field to
    -- background.
    --
    -- If you specify the raw content of an APNs push notification, the message
    -- payload has to include the content-available key. For silent
    -- (background) notifications, set the value of content-available to 1.
    -- Additionally, the message payload for a silent notification can\'t
    -- include the alert, badge, or sound keys. For more information, see
    -- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
    -- and
    -- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
    -- on the Apple Developer website.
    --
    -- Apple has indicated that they will throttle \"excessive\" background
    -- notifications based on current traffic volumes. To prevent your
    -- notifications being throttled, Apple recommends that you send no more
    -- than 3 silent push notifications to each recipient per hour.
    APNSMessage -> Maybe Bool
silentPush :: Prelude.Maybe Prelude.Bool,
    -- | The type of push notification to send. Valid values are:
    --
    -- -   alert - For a standard notification that\'s displayed on
    --     recipients\' devices and prompts a recipient to interact with the
    --     notification.
    --
    -- -   background - For a silent notification that delivers content in the
    --     background and isn\'t displayed on recipients\' devices.
    --
    -- -   complication - For a notification that contains update information
    --     for an app’s complication timeline.
    --
    -- -   fileprovider - For a notification that signals changes to a File
    --     Provider extension.
    --
    -- -   mdm - For a notification that tells managed devices to contact the
    --     MDM server.
    --
    -- -   voip - For a notification that provides information about an
    --     incoming VoIP call.
    --
    -- Amazon Pinpoint specifies this value in the apns-push-type request
    -- header when it sends the notification message to APNs. If you don\'t
    -- specify a value for this property, Amazon Pinpoint sets the value to
    -- alert or background automatically, based on the value that you specify
    -- for the SilentPush or RawContent property of the message.
    --
    -- For more information about the apns-push-type request header, see
    -- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns Sending Notification Requests to APNs>
    -- on the Apple Developer website.
    APNSMessage -> Maybe Text
aPNSPushType :: Prelude.Maybe Prelude.Text,
    -- | para>5 - Low priority, the notification might be delayed, delivered as
    -- part of a group, or throttled.
    --
    -- \/listitem>
    --
    -- 10 - High priority, the notification is sent immediately. This is the
    -- default value. A high priority notification should trigger an alert,
    -- play a sound, or badge your app\'s icon on the recipient\'s device.
    --
    -- \/para>
    --
    -- Amazon Pinpoint specifies this value in the apns-priority request header
    -- when it sends the notification message to APNs.
    --
    -- The equivalent values for Firebase Cloud Messaging (FCM), formerly
    -- Google Cloud Messaging (GCM), are normal, for 5, and high, for 10. If
    -- you specify an FCM value for this property, Amazon Pinpoint accepts and
    -- converts the value to the corresponding APNs value.
    APNSMessage -> Maybe Text
priority :: Prelude.Maybe Prelude.Text,
    -- | The raw, JSON-formatted string to use as the payload for the
    -- notification message. If specified, this value overrides all other
    -- content for the message.
    --
    -- If you specify the raw content of an APNs push notification, the message
    -- payload has to include the content-available key. The value of the
    -- content-available key has to be an integer, and can only be 0 or 1. If
    -- you\'re sending a standard notification, set the value of
    -- content-available to 0. If you\'re sending a silent (background)
    -- notification, set the value of content-available to 1. Additionally,
    -- silent notification payloads can\'t include the alert, badge, or sound
    -- keys. For more information, see
    -- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
    -- and
    -- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
    -- on the Apple Developer website.
    APNSMessage -> Maybe Text
rawContent :: Prelude.Maybe Prelude.Text,
    -- | The JSON payload to use for a silent push notification. This payload is
    -- added to the data.pinpoint.jsonBody object of the notification.
    APNSMessage -> Maybe (HashMap Text Text)
data' :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The body of the notification message.
    APNSMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | The key that indicates the notification type for the push notification.
    -- This key is a value that\'s defined by the identifier property of one of
    -- your app\'s registered categories.
    APNSMessage -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
    -- | The amount of time, in seconds, that APNs should store and attempt to
    -- deliver the push notification, if the service is unable to deliver the
    -- notification the first time. If this value is 0, APNs treats the
    -- notification as if it expires immediately and the service doesn\'t store
    -- or try to deliver the notification again.
    --
    -- Amazon Pinpoint specifies this value in the apns-expiration request
    -- header when it sends the notification message to APNs.
    APNSMessage -> Maybe Int
timeToLive :: Prelude.Maybe Prelude.Int,
    -- | The URL to open in the recipient\'s default mobile browser, if a
    -- recipient taps the push notification and the value of the Action
    -- property is URL.
    APNSMessage -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The key for the sound to play when the recipient receives the push
    -- notification. The value for this key is the name of a sound file in your
    -- app\'s main bundle or the Library\/Sounds folder in your app\'s data
    -- container. If the sound file can\'t be found or you specify default for
    -- the value, the system plays the default alert sound.
    APNSMessage -> Maybe Text
sound :: Prelude.Maybe Prelude.Text,
    -- | The action to occur if the recipient taps the push notification. Valid
    -- values are:
    --
    -- -   OPEN_APP - Your app opens or it becomes the foreground app if it was
    --     sent to the background. This is the default action.
    --
    -- -   DEEP_LINK - Your app opens and displays a designated user interface
    --     in the app. This setting uses the deep-linking features of the iOS
    --     platform.
    --
    -- -   URL - The default mobile browser on the recipient\'s device opens
    --     and loads the web page at a URL that you specify.
    APNSMessage -> Maybe Action
action :: Prelude.Maybe Action,
    -- | The URL of an image or video to display in the push notification.
    APNSMessage -> Maybe Text
mediaUrl :: Prelude.Maybe Prelude.Text,
    -- | The authentication method that you want Amazon Pinpoint to use when
    -- authenticating with APNs, CERTIFICATE or TOKEN.
    APNSMessage -> Maybe Text
preferredAuthenticationMethod :: Prelude.Maybe Prelude.Text,
    -- | The key that indicates whether and how to modify the badge of your
    -- app\'s icon when the recipient receives the push notification. If this
    -- key isn\'t included in the dictionary, the badge doesn\'t change. To
    -- remove the badge, set this value to 0.
    APNSMessage -> Maybe Int
badge :: Prelude.Maybe Prelude.Int,
    -- | The title to display above the notification message on the recipient\'s
    -- device.
    APNSMessage -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | The key that represents your app-specific identifier for grouping
    -- notifications. If you provide a Notification Content app extension, you
    -- can use this value to group your notifications together.
    APNSMessage -> Maybe Text
threadId :: Prelude.Maybe Prelude.Text,
    -- | An arbitrary identifier that, if assigned to multiple messages, APNs
    -- uses to coalesce the messages into a single push notification instead of
    -- delivering each message individually. This value can\'t exceed 64 bytes.
    --
    -- Amazon Pinpoint specifies this value in the apns-collapse-id request
    -- header when it sends the notification message to APNs.
    APNSMessage -> Maybe Text
collapseId :: Prelude.Maybe Prelude.Text
  }
  deriving (APNSMessage -> APNSMessage -> Bool
(APNSMessage -> APNSMessage -> Bool)
-> (APNSMessage -> APNSMessage -> Bool) -> Eq APNSMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: APNSMessage -> APNSMessage -> Bool
$c/= :: APNSMessage -> APNSMessage -> Bool
== :: APNSMessage -> APNSMessage -> Bool
$c== :: APNSMessage -> APNSMessage -> Bool
Prelude.Eq, ReadPrec [APNSMessage]
ReadPrec APNSMessage
Int -> ReadS APNSMessage
ReadS [APNSMessage]
(Int -> ReadS APNSMessage)
-> ReadS [APNSMessage]
-> ReadPrec APNSMessage
-> ReadPrec [APNSMessage]
-> Read APNSMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [APNSMessage]
$creadListPrec :: ReadPrec [APNSMessage]
readPrec :: ReadPrec APNSMessage
$creadPrec :: ReadPrec APNSMessage
readList :: ReadS [APNSMessage]
$creadList :: ReadS [APNSMessage]
readsPrec :: Int -> ReadS APNSMessage
$creadsPrec :: Int -> ReadS APNSMessage
Prelude.Read, Int -> APNSMessage -> ShowS
[APNSMessage] -> ShowS
APNSMessage -> String
(Int -> APNSMessage -> ShowS)
-> (APNSMessage -> String)
-> ([APNSMessage] -> ShowS)
-> Show APNSMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [APNSMessage] -> ShowS
$cshowList :: [APNSMessage] -> ShowS
show :: APNSMessage -> String
$cshow :: APNSMessage -> String
showsPrec :: Int -> APNSMessage -> ShowS
$cshowsPrec :: Int -> APNSMessage -> ShowS
Prelude.Show, (forall x. APNSMessage -> Rep APNSMessage x)
-> (forall x. Rep APNSMessage x -> APNSMessage)
-> Generic APNSMessage
forall x. Rep APNSMessage x -> APNSMessage
forall x. APNSMessage -> Rep APNSMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep APNSMessage x -> APNSMessage
$cfrom :: forall x. APNSMessage -> Rep APNSMessage x
Prelude.Generic)

-- |
-- Create a value of 'APNSMessage' 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:
--
-- 'substitutions', 'aPNSMessage_substitutions' - The default message variables to use in the notification message. You
-- can override these default variables with individual address variables.
--
-- 'silentPush', 'aPNSMessage_silentPush' - Specifies whether the notification is a silent push notification. A
-- silent (or background) push notification isn\'t displayed on
-- recipients\' devices. You can use silent push notifications to make
-- small updates to your app, or to display messages in an in-app message
-- center.
--
-- Amazon Pinpoint uses this property to determine the correct value for
-- the apns-push-type request header when it sends the notification message
-- to APNs. If you specify a value of true for this property, Amazon
-- Pinpoint sets the value for the apns-push-type header field to
-- background.
--
-- If you specify the raw content of an APNs push notification, the message
-- payload has to include the content-available key. For silent
-- (background) notifications, set the value of content-available to 1.
-- Additionally, the message payload for a silent notification can\'t
-- include the alert, badge, or sound keys. For more information, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
-- and
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
-- on the Apple Developer website.
--
-- Apple has indicated that they will throttle \"excessive\" background
-- notifications based on current traffic volumes. To prevent your
-- notifications being throttled, Apple recommends that you send no more
-- than 3 silent push notifications to each recipient per hour.
--
-- 'aPNSPushType', 'aPNSMessage_aPNSPushType' - The type of push notification to send. Valid values are:
--
-- -   alert - For a standard notification that\'s displayed on
--     recipients\' devices and prompts a recipient to interact with the
--     notification.
--
-- -   background - For a silent notification that delivers content in the
--     background and isn\'t displayed on recipients\' devices.
--
-- -   complication - For a notification that contains update information
--     for an app’s complication timeline.
--
-- -   fileprovider - For a notification that signals changes to a File
--     Provider extension.
--
-- -   mdm - For a notification that tells managed devices to contact the
--     MDM server.
--
-- -   voip - For a notification that provides information about an
--     incoming VoIP call.
--
-- Amazon Pinpoint specifies this value in the apns-push-type request
-- header when it sends the notification message to APNs. If you don\'t
-- specify a value for this property, Amazon Pinpoint sets the value to
-- alert or background automatically, based on the value that you specify
-- for the SilentPush or RawContent property of the message.
--
-- For more information about the apns-push-type request header, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns Sending Notification Requests to APNs>
-- on the Apple Developer website.
--
-- 'priority', 'aPNSMessage_priority' - para>5 - Low priority, the notification might be delayed, delivered as
-- part of a group, or throttled.
--
-- \/listitem>
--
-- 10 - High priority, the notification is sent immediately. This is the
-- default value. A high priority notification should trigger an alert,
-- play a sound, or badge your app\'s icon on the recipient\'s device.
--
-- \/para>
--
-- Amazon Pinpoint specifies this value in the apns-priority request header
-- when it sends the notification message to APNs.
--
-- The equivalent values for Firebase Cloud Messaging (FCM), formerly
-- Google Cloud Messaging (GCM), are normal, for 5, and high, for 10. If
-- you specify an FCM value for this property, Amazon Pinpoint accepts and
-- converts the value to the corresponding APNs value.
--
-- 'rawContent', 'aPNSMessage_rawContent' - The raw, JSON-formatted string to use as the payload for the
-- notification message. If specified, this value overrides all other
-- content for the message.
--
-- If you specify the raw content of an APNs push notification, the message
-- payload has to include the content-available key. The value of the
-- content-available key has to be an integer, and can only be 0 or 1. If
-- you\'re sending a standard notification, set the value of
-- content-available to 0. If you\'re sending a silent (background)
-- notification, set the value of content-available to 1. Additionally,
-- silent notification payloads can\'t include the alert, badge, or sound
-- keys. For more information, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
-- and
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
-- on the Apple Developer website.
--
-- 'data'', 'aPNSMessage_data' - The JSON payload to use for a silent push notification. This payload is
-- added to the data.pinpoint.jsonBody object of the notification.
--
-- 'body', 'aPNSMessage_body' - The body of the notification message.
--
-- 'category', 'aPNSMessage_category' - The key that indicates the notification type for the push notification.
-- This key is a value that\'s defined by the identifier property of one of
-- your app\'s registered categories.
--
-- 'timeToLive', 'aPNSMessage_timeToLive' - The amount of time, in seconds, that APNs should store and attempt to
-- deliver the push notification, if the service is unable to deliver the
-- notification the first time. If this value is 0, APNs treats the
-- notification as if it expires immediately and the service doesn\'t store
-- or try to deliver the notification again.
--
-- Amazon Pinpoint specifies this value in the apns-expiration request
-- header when it sends the notification message to APNs.
--
-- 'url', 'aPNSMessage_url' - The URL to open in the recipient\'s default mobile browser, if a
-- recipient taps the push notification and the value of the Action
-- property is URL.
--
-- 'sound', 'aPNSMessage_sound' - The key for the sound to play when the recipient receives the push
-- notification. The value for this key is the name of a sound file in your
-- app\'s main bundle or the Library\/Sounds folder in your app\'s data
-- container. If the sound file can\'t be found or you specify default for
-- the value, the system plays the default alert sound.
--
-- 'action', 'aPNSMessage_action' - The action to occur if the recipient taps the push notification. Valid
-- values are:
--
-- -   OPEN_APP - Your app opens or it becomes the foreground app if it was
--     sent to the background. This is the default action.
--
-- -   DEEP_LINK - Your app opens and displays a designated user interface
--     in the app. This setting uses the deep-linking features of the iOS
--     platform.
--
-- -   URL - The default mobile browser on the recipient\'s device opens
--     and loads the web page at a URL that you specify.
--
-- 'mediaUrl', 'aPNSMessage_mediaUrl' - The URL of an image or video to display in the push notification.
--
-- 'preferredAuthenticationMethod', 'aPNSMessage_preferredAuthenticationMethod' - The authentication method that you want Amazon Pinpoint to use when
-- authenticating with APNs, CERTIFICATE or TOKEN.
--
-- 'badge', 'aPNSMessage_badge' - The key that indicates whether and how to modify the badge of your
-- app\'s icon when the recipient receives the push notification. If this
-- key isn\'t included in the dictionary, the badge doesn\'t change. To
-- remove the badge, set this value to 0.
--
-- 'title', 'aPNSMessage_title' - The title to display above the notification message on the recipient\'s
-- device.
--
-- 'threadId', 'aPNSMessage_threadId' - The key that represents your app-specific identifier for grouping
-- notifications. If you provide a Notification Content app extension, you
-- can use this value to group your notifications together.
--
-- 'collapseId', 'aPNSMessage_collapseId' - An arbitrary identifier that, if assigned to multiple messages, APNs
-- uses to coalesce the messages into a single push notification instead of
-- delivering each message individually. This value can\'t exceed 64 bytes.
--
-- Amazon Pinpoint specifies this value in the apns-collapse-id request
-- header when it sends the notification message to APNs.
newAPNSMessage ::
  APNSMessage
newAPNSMessage :: APNSMessage
newAPNSMessage =
  APNSMessage' :: Maybe (HashMap Text [Text])
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> APNSMessage
APNSMessage'
    { $sel:substitutions:APNSMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:silentPush:APNSMessage' :: Maybe Bool
silentPush = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:aPNSPushType:APNSMessage' :: Maybe Text
aPNSPushType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:APNSMessage' :: Maybe Text
priority = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rawContent:APNSMessage' :: Maybe Text
rawContent = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:data':APNSMessage' :: Maybe (HashMap Text Text)
data' = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:body:APNSMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:category:APNSMessage' :: Maybe Text
category = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeToLive:APNSMessage' :: Maybe Int
timeToLive = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:url:APNSMessage' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sound:APNSMessage' :: Maybe Text
sound = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:action:APNSMessage' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
      $sel:mediaUrl:APNSMessage' :: Maybe Text
mediaUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:preferredAuthenticationMethod:APNSMessage' :: Maybe Text
preferredAuthenticationMethod = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:badge:APNSMessage' :: Maybe Int
badge = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:title:APNSMessage' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:threadId:APNSMessage' :: Maybe Text
threadId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:collapseId:APNSMessage' :: Maybe Text
collapseId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The default message variables to use in the notification message. You
-- can override these default variables with individual address variables.
aPNSMessage_substitutions :: Lens.Lens' APNSMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
aPNSMessage_substitutions :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> APNSMessage -> f APNSMessage
aPNSMessage_substitutions = (APNSMessage -> Maybe (HashMap Text [Text]))
-> (APNSMessage -> Maybe (HashMap Text [Text]) -> APNSMessage)
-> Lens
     APNSMessage
     APNSMessage
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe (HashMap Text [Text])
substitutions :: Maybe (HashMap Text [Text])
$sel:substitutions:APNSMessage' :: APNSMessage -> Maybe (HashMap Text [Text])
substitutions} -> Maybe (HashMap Text [Text])
substitutions) (\s :: APNSMessage
s@APNSMessage' {} Maybe (HashMap Text [Text])
a -> APNSMessage
s {$sel:substitutions:APNSMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
a} :: APNSMessage) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> APNSMessage -> f APNSMessage)
-> ((Maybe (HashMap Text [Text])
     -> f (Maybe (HashMap Text [Text])))
    -> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> APNSMessage
-> f APNSMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
-> Iso
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [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
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether the notification is a silent push notification. A
-- silent (or background) push notification isn\'t displayed on
-- recipients\' devices. You can use silent push notifications to make
-- small updates to your app, or to display messages in an in-app message
-- center.
--
-- Amazon Pinpoint uses this property to determine the correct value for
-- the apns-push-type request header when it sends the notification message
-- to APNs. If you specify a value of true for this property, Amazon
-- Pinpoint sets the value for the apns-push-type header field to
-- background.
--
-- If you specify the raw content of an APNs push notification, the message
-- payload has to include the content-available key. For silent
-- (background) notifications, set the value of content-available to 1.
-- Additionally, the message payload for a silent notification can\'t
-- include the alert, badge, or sound keys. For more information, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
-- and
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
-- on the Apple Developer website.
--
-- Apple has indicated that they will throttle \"excessive\" background
-- notifications based on current traffic volumes. To prevent your
-- notifications being throttled, Apple recommends that you send no more
-- than 3 silent push notifications to each recipient per hour.
aPNSMessage_silentPush :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Bool)
aPNSMessage_silentPush :: (Maybe Bool -> f (Maybe Bool)) -> APNSMessage -> f APNSMessage
aPNSMessage_silentPush = (APNSMessage -> Maybe Bool)
-> (APNSMessage -> Maybe Bool -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Bool
silentPush :: Maybe Bool
$sel:silentPush:APNSMessage' :: APNSMessage -> Maybe Bool
silentPush} -> Maybe Bool
silentPush) (\s :: APNSMessage
s@APNSMessage' {} Maybe Bool
a -> APNSMessage
s {$sel:silentPush:APNSMessage' :: Maybe Bool
silentPush = Maybe Bool
a} :: APNSMessage)

-- | The type of push notification to send. Valid values are:
--
-- -   alert - For a standard notification that\'s displayed on
--     recipients\' devices and prompts a recipient to interact with the
--     notification.
--
-- -   background - For a silent notification that delivers content in the
--     background and isn\'t displayed on recipients\' devices.
--
-- -   complication - For a notification that contains update information
--     for an app’s complication timeline.
--
-- -   fileprovider - For a notification that signals changes to a File
--     Provider extension.
--
-- -   mdm - For a notification that tells managed devices to contact the
--     MDM server.
--
-- -   voip - For a notification that provides information about an
--     incoming VoIP call.
--
-- Amazon Pinpoint specifies this value in the apns-push-type request
-- header when it sends the notification message to APNs. If you don\'t
-- specify a value for this property, Amazon Pinpoint sets the value to
-- alert or background automatically, based on the value that you specify
-- for the SilentPush or RawContent property of the message.
--
-- For more information about the apns-push-type request header, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns Sending Notification Requests to APNs>
-- on the Apple Developer website.
aPNSMessage_aPNSPushType :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_aPNSPushType :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_aPNSPushType = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
aPNSPushType :: Maybe Text
$sel:aPNSPushType:APNSMessage' :: APNSMessage -> Maybe Text
aPNSPushType} -> Maybe Text
aPNSPushType) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:aPNSPushType:APNSMessage' :: Maybe Text
aPNSPushType = Maybe Text
a} :: APNSMessage)

-- | para>5 - Low priority, the notification might be delayed, delivered as
-- part of a group, or throttled.
--
-- \/listitem>
--
-- 10 - High priority, the notification is sent immediately. This is the
-- default value. A high priority notification should trigger an alert,
-- play a sound, or badge your app\'s icon on the recipient\'s device.
--
-- \/para>
--
-- Amazon Pinpoint specifies this value in the apns-priority request header
-- when it sends the notification message to APNs.
--
-- The equivalent values for Firebase Cloud Messaging (FCM), formerly
-- Google Cloud Messaging (GCM), are normal, for 5, and high, for 10. If
-- you specify an FCM value for this property, Amazon Pinpoint accepts and
-- converts the value to the corresponding APNs value.
aPNSMessage_priority :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_priority :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_priority = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
priority :: Maybe Text
$sel:priority:APNSMessage' :: APNSMessage -> Maybe Text
priority} -> Maybe Text
priority) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:priority:APNSMessage' :: Maybe Text
priority = Maybe Text
a} :: APNSMessage)

-- | The raw, JSON-formatted string to use as the payload for the
-- notification message. If specified, this value overrides all other
-- content for the message.
--
-- If you specify the raw content of an APNs push notification, the message
-- payload has to include the content-available key. The value of the
-- content-available key has to be an integer, and can only be 0 or 1. If
-- you\'re sending a standard notification, set the value of
-- content-available to 0. If you\'re sending a silent (background)
-- notification, set the value of content-available to 1. Additionally,
-- silent notification payloads can\'t include the alert, badge, or sound
-- keys. For more information, see
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification Generating a Remote Notification>
-- and
-- <https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app Pushing Background Updates to Your App>
-- on the Apple Developer website.
aPNSMessage_rawContent :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_rawContent :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_rawContent = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
rawContent :: Maybe Text
$sel:rawContent:APNSMessage' :: APNSMessage -> Maybe Text
rawContent} -> Maybe Text
rawContent) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:rawContent:APNSMessage' :: Maybe Text
rawContent = Maybe Text
a} :: APNSMessage)

-- | The JSON payload to use for a silent push notification. This payload is
-- added to the data.pinpoint.jsonBody object of the notification.
aPNSMessage_data :: Lens.Lens' APNSMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
aPNSMessage_data :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> APNSMessage -> f APNSMessage
aPNSMessage_data = (APNSMessage -> Maybe (HashMap Text Text))
-> (APNSMessage -> Maybe (HashMap Text Text) -> APNSMessage)
-> Lens
     APNSMessage
     APNSMessage
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe (HashMap Text Text)
data' :: Maybe (HashMap Text Text)
$sel:data':APNSMessage' :: APNSMessage -> Maybe (HashMap Text Text)
data'} -> Maybe (HashMap Text Text)
data') (\s :: APNSMessage
s@APNSMessage' {} Maybe (HashMap Text Text)
a -> APNSMessage
s {$sel:data':APNSMessage' :: Maybe (HashMap Text Text)
data' = Maybe (HashMap Text Text)
a} :: APNSMessage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> APNSMessage -> f APNSMessage)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> APNSMessage
-> f APNSMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The body of the notification message.
aPNSMessage_body :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_body :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_body = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
body :: Maybe Text
$sel:body:APNSMessage' :: APNSMessage -> Maybe Text
body} -> Maybe Text
body) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:body:APNSMessage' :: Maybe Text
body = Maybe Text
a} :: APNSMessage)

-- | The key that indicates the notification type for the push notification.
-- This key is a value that\'s defined by the identifier property of one of
-- your app\'s registered categories.
aPNSMessage_category :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_category :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_category = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
category :: Maybe Text
$sel:category:APNSMessage' :: APNSMessage -> Maybe Text
category} -> Maybe Text
category) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:category:APNSMessage' :: Maybe Text
category = Maybe Text
a} :: APNSMessage)

-- | The amount of time, in seconds, that APNs should store and attempt to
-- deliver the push notification, if the service is unable to deliver the
-- notification the first time. If this value is 0, APNs treats the
-- notification as if it expires immediately and the service doesn\'t store
-- or try to deliver the notification again.
--
-- Amazon Pinpoint specifies this value in the apns-expiration request
-- header when it sends the notification message to APNs.
aPNSMessage_timeToLive :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Int)
aPNSMessage_timeToLive :: (Maybe Int -> f (Maybe Int)) -> APNSMessage -> f APNSMessage
aPNSMessage_timeToLive = (APNSMessage -> Maybe Int)
-> (APNSMessage -> Maybe Int -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Int
timeToLive :: Maybe Int
$sel:timeToLive:APNSMessage' :: APNSMessage -> Maybe Int
timeToLive} -> Maybe Int
timeToLive) (\s :: APNSMessage
s@APNSMessage' {} Maybe Int
a -> APNSMessage
s {$sel:timeToLive:APNSMessage' :: Maybe Int
timeToLive = Maybe Int
a} :: APNSMessage)

-- | The URL to open in the recipient\'s default mobile browser, if a
-- recipient taps the push notification and the value of the Action
-- property is URL.
aPNSMessage_url :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_url :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_url = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
url :: Maybe Text
$sel:url:APNSMessage' :: APNSMessage -> Maybe Text
url} -> Maybe Text
url) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:url:APNSMessage' :: Maybe Text
url = Maybe Text
a} :: APNSMessage)

-- | The key for the sound to play when the recipient receives the push
-- notification. The value for this key is the name of a sound file in your
-- app\'s main bundle or the Library\/Sounds folder in your app\'s data
-- container. If the sound file can\'t be found or you specify default for
-- the value, the system plays the default alert sound.
aPNSMessage_sound :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_sound :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_sound = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
sound :: Maybe Text
$sel:sound:APNSMessage' :: APNSMessage -> Maybe Text
sound} -> Maybe Text
sound) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:sound:APNSMessage' :: Maybe Text
sound = Maybe Text
a} :: APNSMessage)

-- | The action to occur if the recipient taps the push notification. Valid
-- values are:
--
-- -   OPEN_APP - Your app opens or it becomes the foreground app if it was
--     sent to the background. This is the default action.
--
-- -   DEEP_LINK - Your app opens and displays a designated user interface
--     in the app. This setting uses the deep-linking features of the iOS
--     platform.
--
-- -   URL - The default mobile browser on the recipient\'s device opens
--     and loads the web page at a URL that you specify.
aPNSMessage_action :: Lens.Lens' APNSMessage (Prelude.Maybe Action)
aPNSMessage_action :: (Maybe Action -> f (Maybe Action)) -> APNSMessage -> f APNSMessage
aPNSMessage_action = (APNSMessage -> Maybe Action)
-> (APNSMessage -> Maybe Action -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Action
action :: Maybe Action
$sel:action:APNSMessage' :: APNSMessage -> Maybe Action
action} -> Maybe Action
action) (\s :: APNSMessage
s@APNSMessage' {} Maybe Action
a -> APNSMessage
s {$sel:action:APNSMessage' :: Maybe Action
action = Maybe Action
a} :: APNSMessage)

-- | The URL of an image or video to display in the push notification.
aPNSMessage_mediaUrl :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_mediaUrl :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_mediaUrl = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
mediaUrl :: Maybe Text
$sel:mediaUrl:APNSMessage' :: APNSMessage -> Maybe Text
mediaUrl} -> Maybe Text
mediaUrl) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:mediaUrl:APNSMessage' :: Maybe Text
mediaUrl = Maybe Text
a} :: APNSMessage)

-- | The authentication method that you want Amazon Pinpoint to use when
-- authenticating with APNs, CERTIFICATE or TOKEN.
aPNSMessage_preferredAuthenticationMethod :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_preferredAuthenticationMethod :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_preferredAuthenticationMethod = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
preferredAuthenticationMethod :: Maybe Text
$sel:preferredAuthenticationMethod:APNSMessage' :: APNSMessage -> Maybe Text
preferredAuthenticationMethod} -> Maybe Text
preferredAuthenticationMethod) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:preferredAuthenticationMethod:APNSMessage' :: Maybe Text
preferredAuthenticationMethod = Maybe Text
a} :: APNSMessage)

-- | The key that indicates whether and how to modify the badge of your
-- app\'s icon when the recipient receives the push notification. If this
-- key isn\'t included in the dictionary, the badge doesn\'t change. To
-- remove the badge, set this value to 0.
aPNSMessage_badge :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Int)
aPNSMessage_badge :: (Maybe Int -> f (Maybe Int)) -> APNSMessage -> f APNSMessage
aPNSMessage_badge = (APNSMessage -> Maybe Int)
-> (APNSMessage -> Maybe Int -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Int
badge :: Maybe Int
$sel:badge:APNSMessage' :: APNSMessage -> Maybe Int
badge} -> Maybe Int
badge) (\s :: APNSMessage
s@APNSMessage' {} Maybe Int
a -> APNSMessage
s {$sel:badge:APNSMessage' :: Maybe Int
badge = Maybe Int
a} :: APNSMessage)

-- | The title to display above the notification message on the recipient\'s
-- device.
aPNSMessage_title :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_title :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_title = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
title :: Maybe Text
$sel:title:APNSMessage' :: APNSMessage -> Maybe Text
title} -> Maybe Text
title) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:title:APNSMessage' :: Maybe Text
title = Maybe Text
a} :: APNSMessage)

-- | The key that represents your app-specific identifier for grouping
-- notifications. If you provide a Notification Content app extension, you
-- can use this value to group your notifications together.
aPNSMessage_threadId :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_threadId :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_threadId = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
threadId :: Maybe Text
$sel:threadId:APNSMessage' :: APNSMessage -> Maybe Text
threadId} -> Maybe Text
threadId) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:threadId:APNSMessage' :: Maybe Text
threadId = Maybe Text
a} :: APNSMessage)

-- | An arbitrary identifier that, if assigned to multiple messages, APNs
-- uses to coalesce the messages into a single push notification instead of
-- delivering each message individually. This value can\'t exceed 64 bytes.
--
-- Amazon Pinpoint specifies this value in the apns-collapse-id request
-- header when it sends the notification message to APNs.
aPNSMessage_collapseId :: Lens.Lens' APNSMessage (Prelude.Maybe Prelude.Text)
aPNSMessage_collapseId :: (Maybe Text -> f (Maybe Text)) -> APNSMessage -> f APNSMessage
aPNSMessage_collapseId = (APNSMessage -> Maybe Text)
-> (APNSMessage -> Maybe Text -> APNSMessage)
-> Lens APNSMessage APNSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSMessage' {Maybe Text
collapseId :: Maybe Text
$sel:collapseId:APNSMessage' :: APNSMessage -> Maybe Text
collapseId} -> Maybe Text
collapseId) (\s :: APNSMessage
s@APNSMessage' {} Maybe Text
a -> APNSMessage
s {$sel:collapseId:APNSMessage' :: Maybe Text
collapseId = Maybe Text
a} :: APNSMessage)

instance Prelude.Hashable APNSMessage

instance Prelude.NFData APNSMessage

instance Core.ToJSON APNSMessage where
  toJSON :: APNSMessage -> Value
toJSON APNSMessage' {Maybe Bool
Maybe Int
Maybe Text
Maybe (HashMap Text [Text])
Maybe (HashMap Text Text)
Maybe Action
collapseId :: Maybe Text
threadId :: Maybe Text
title :: Maybe Text
badge :: Maybe Int
preferredAuthenticationMethod :: Maybe Text
mediaUrl :: Maybe Text
action :: Maybe Action
sound :: Maybe Text
url :: Maybe Text
timeToLive :: Maybe Int
category :: Maybe Text
body :: Maybe Text
data' :: Maybe (HashMap Text Text)
rawContent :: Maybe Text
priority :: Maybe Text
aPNSPushType :: Maybe Text
silentPush :: Maybe Bool
substitutions :: Maybe (HashMap Text [Text])
$sel:collapseId:APNSMessage' :: APNSMessage -> Maybe Text
$sel:threadId:APNSMessage' :: APNSMessage -> Maybe Text
$sel:title:APNSMessage' :: APNSMessage -> Maybe Text
$sel:badge:APNSMessage' :: APNSMessage -> Maybe Int
$sel:preferredAuthenticationMethod:APNSMessage' :: APNSMessage -> Maybe Text
$sel:mediaUrl:APNSMessage' :: APNSMessage -> Maybe Text
$sel:action:APNSMessage' :: APNSMessage -> Maybe Action
$sel:sound:APNSMessage' :: APNSMessage -> Maybe Text
$sel:url:APNSMessage' :: APNSMessage -> Maybe Text
$sel:timeToLive:APNSMessage' :: APNSMessage -> Maybe Int
$sel:category:APNSMessage' :: APNSMessage -> Maybe Text
$sel:body:APNSMessage' :: APNSMessage -> Maybe Text
$sel:data':APNSMessage' :: APNSMessage -> Maybe (HashMap Text Text)
$sel:rawContent:APNSMessage' :: APNSMessage -> Maybe Text
$sel:priority:APNSMessage' :: APNSMessage -> Maybe Text
$sel:aPNSPushType:APNSMessage' :: APNSMessage -> Maybe Text
$sel:silentPush:APNSMessage' :: APNSMessage -> Maybe Bool
$sel:substitutions:APNSMessage' :: APNSMessage -> Maybe (HashMap Text [Text])
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Substitutions" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
substitutions,
            (Text
"SilentPush" 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
silentPush,
            (Text
"APNSPushType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
aPNSPushType,
            (Text
"Priority" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
priority,
            (Text
"RawContent" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
rawContent,
            (Text
"Data" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
data',
            (Text
"Body" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
body,
            (Text
"Category" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
category,
            (Text
"TimeToLive" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
timeToLive,
            (Text
"Url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url,
            (Text
"Sound" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sound,
            (Text
"Action" Text -> Action -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Action -> Pair) -> Maybe Action -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Action
action,
            (Text
"MediaUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
mediaUrl,
            (Text
"PreferredAuthenticationMethod" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
preferredAuthenticationMethod,
            (Text
"Badge" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
badge,
            (Text
"Title" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
title,
            (Text
"ThreadId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
threadId,
            (Text
"CollapseId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
collapseId
          ]
      )