{-# 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.GCMMessage
-- 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.GCMMessage 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 GCM channel. The GCM channel enables Amazon
-- Pinpoint to send messages to the Firebase Cloud Messaging (FCM),
-- formerly Google Cloud Messaging (GCM), service.
--
-- /See:/ 'newGCMMessage' smart constructor.
data GCMMessage = GCMMessage'
  { -- | The default message variables to use in the notification message. You
    -- can override the default variables with individual address variables.
    GCMMessage -> Maybe (HashMap Text [Text])
substitutions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | Specifies whether the notification is a silent push notification, which
    -- is a push notification that doesn\'t display on a recipient\'s device.
    -- Silent push notifications can be used for cases such as updating an
    -- app\'s configuration or supporting phone home functionality.
    GCMMessage -> Maybe Bool
silentPush :: Prelude.Maybe Prelude.Bool,
    -- | The URL of the large icon image to display in the content view of the
    -- push notification.
    GCMMessage -> Maybe Text
imageIconUrl :: Prelude.Maybe Prelude.Text,
    -- | para>normal - The notification might be delayed. Delivery is optimized
    -- for battery usage on the recipient\'s device. Use this value unless
    -- immediate delivery is required.
    --
    -- \/listitem>
    --
    -- high - The notification is sent immediately and might wake a sleeping
    -- device.
    --
    -- \/para>
    --
    -- Amazon Pinpoint specifies this value in the FCM priority parameter when
    -- it sends the notification message to FCM.
    --
    -- The equivalent values for Apple Push Notification service (APNs) are 5,
    -- for normal, and 10, for high. If you specify an APNs value for this
    -- property, Amazon Pinpoint accepts and converts the value to the
    -- corresponding FCM value.
    GCMMessage -> 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.
    GCMMessage -> Maybe Text
rawContent :: Prelude.Maybe Prelude.Text,
    -- | The JSON data payload to use for the push notification, if the
    -- notification is a silent push notification. This payload is added to the
    -- data.pinpoint.jsonBody object of the notification.
    GCMMessage -> Maybe (HashMap Text Text)
data' :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The package name of the application where registration tokens must match
    -- in order for the recipient to receive the message.
    GCMMessage -> Maybe Text
restrictedPackageName :: Prelude.Maybe Prelude.Text,
    -- | The URL of the small icon image to display in the status bar and the
    -- content view of the push notification.
    GCMMessage -> Maybe Text
smallImageIconUrl :: Prelude.Maybe Prelude.Text,
    -- | The body of the notification message.
    GCMMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | The amount of time, in seconds, that FCM should store and attempt to
    -- deliver the push notification, if the service is unable to deliver the
    -- notification the first time. If you don\'t specify this value, FCM
    -- defaults to the maximum value, which is 2,419,200 seconds (28 days).
    --
    -- Amazon Pinpoint specifies this value in the FCM time_to_live parameter
    -- when it sends the notification message to FCM.
    GCMMessage -> 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.
    GCMMessage -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The sound to play when the recipient receives the push notification. You
    -- can use the default stream or specify the file name of a sound resource
    -- that\'s bundled in your app. On an Android platform, the sound file must
    -- reside in \/res\/raw\/.
    GCMMessage -> 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 action uses the deep-linking features of the
    --     Android platform.
    --
    -- -   URL - The default mobile browser on the recipient\'s device opens
    --     and loads the web page at a URL that you specify.
    GCMMessage -> Maybe Action
action :: Prelude.Maybe Action,
    -- | An arbitrary string that identifies a group of messages that can be
    -- collapsed to ensure that only the last message is sent when delivery can
    -- resume. This helps avoid sending too many instances of the same messages
    -- when the recipient\'s device comes online again or becomes active.
    --
    -- Amazon Pinpoint specifies this value in the Firebase Cloud Messaging
    -- (FCM) collapse_key parameter when it sends the notification message to
    -- FCM.
    GCMMessage -> Maybe Text
collapseKey :: Prelude.Maybe Prelude.Text,
    -- | The URL of an image to display in the push notification.
    GCMMessage -> Maybe Text
imageUrl :: Prelude.Maybe Prelude.Text,
    -- | The title to display above the notification message on the recipient\'s
    -- device.
    GCMMessage -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | The icon image name of the asset saved in your app.
    GCMMessage -> Maybe Text
iconReference :: Prelude.Maybe Prelude.Text
  }
  deriving (GCMMessage -> GCMMessage -> Bool
(GCMMessage -> GCMMessage -> Bool)
-> (GCMMessage -> GCMMessage -> Bool) -> Eq GCMMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GCMMessage -> GCMMessage -> Bool
$c/= :: GCMMessage -> GCMMessage -> Bool
== :: GCMMessage -> GCMMessage -> Bool
$c== :: GCMMessage -> GCMMessage -> Bool
Prelude.Eq, ReadPrec [GCMMessage]
ReadPrec GCMMessage
Int -> ReadS GCMMessage
ReadS [GCMMessage]
(Int -> ReadS GCMMessage)
-> ReadS [GCMMessage]
-> ReadPrec GCMMessage
-> ReadPrec [GCMMessage]
-> Read GCMMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GCMMessage]
$creadListPrec :: ReadPrec [GCMMessage]
readPrec :: ReadPrec GCMMessage
$creadPrec :: ReadPrec GCMMessage
readList :: ReadS [GCMMessage]
$creadList :: ReadS [GCMMessage]
readsPrec :: Int -> ReadS GCMMessage
$creadsPrec :: Int -> ReadS GCMMessage
Prelude.Read, Int -> GCMMessage -> ShowS
[GCMMessage] -> ShowS
GCMMessage -> String
(Int -> GCMMessage -> ShowS)
-> (GCMMessage -> String)
-> ([GCMMessage] -> ShowS)
-> Show GCMMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GCMMessage] -> ShowS
$cshowList :: [GCMMessage] -> ShowS
show :: GCMMessage -> String
$cshow :: GCMMessage -> String
showsPrec :: Int -> GCMMessage -> ShowS
$cshowsPrec :: Int -> GCMMessage -> ShowS
Prelude.Show, (forall x. GCMMessage -> Rep GCMMessage x)
-> (forall x. Rep GCMMessage x -> GCMMessage) -> Generic GCMMessage
forall x. Rep GCMMessage x -> GCMMessage
forall x. GCMMessage -> Rep GCMMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GCMMessage x -> GCMMessage
$cfrom :: forall x. GCMMessage -> Rep GCMMessage x
Prelude.Generic)

-- |
-- Create a value of 'GCMMessage' 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', 'gCMMessage_substitutions' - The default message variables to use in the notification message. You
-- can override the default variables with individual address variables.
--
-- 'silentPush', 'gCMMessage_silentPush' - Specifies whether the notification is a silent push notification, which
-- is a push notification that doesn\'t display on a recipient\'s device.
-- Silent push notifications can be used for cases such as updating an
-- app\'s configuration or supporting phone home functionality.
--
-- 'imageIconUrl', 'gCMMessage_imageIconUrl' - The URL of the large icon image to display in the content view of the
-- push notification.
--
-- 'priority', 'gCMMessage_priority' - para>normal - The notification might be delayed. Delivery is optimized
-- for battery usage on the recipient\'s device. Use this value unless
-- immediate delivery is required.
--
-- \/listitem>
--
-- high - The notification is sent immediately and might wake a sleeping
-- device.
--
-- \/para>
--
-- Amazon Pinpoint specifies this value in the FCM priority parameter when
-- it sends the notification message to FCM.
--
-- The equivalent values for Apple Push Notification service (APNs) are 5,
-- for normal, and 10, for high. If you specify an APNs value for this
-- property, Amazon Pinpoint accepts and converts the value to the
-- corresponding FCM value.
--
-- 'rawContent', 'gCMMessage_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.
--
-- 'data'', 'gCMMessage_data' - The JSON data payload to use for the push notification, if the
-- notification is a silent push notification. This payload is added to the
-- data.pinpoint.jsonBody object of the notification.
--
-- 'restrictedPackageName', 'gCMMessage_restrictedPackageName' - The package name of the application where registration tokens must match
-- in order for the recipient to receive the message.
--
-- 'smallImageIconUrl', 'gCMMessage_smallImageIconUrl' - The URL of the small icon image to display in the status bar and the
-- content view of the push notification.
--
-- 'body', 'gCMMessage_body' - The body of the notification message.
--
-- 'timeToLive', 'gCMMessage_timeToLive' - The amount of time, in seconds, that FCM should store and attempt to
-- deliver the push notification, if the service is unable to deliver the
-- notification the first time. If you don\'t specify this value, FCM
-- defaults to the maximum value, which is 2,419,200 seconds (28 days).
--
-- Amazon Pinpoint specifies this value in the FCM time_to_live parameter
-- when it sends the notification message to FCM.
--
-- 'url', 'gCMMessage_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', 'gCMMessage_sound' - The sound to play when the recipient receives the push notification. You
-- can use the default stream or specify the file name of a sound resource
-- that\'s bundled in your app. On an Android platform, the sound file must
-- reside in \/res\/raw\/.
--
-- 'action', 'gCMMessage_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 action uses the deep-linking features of the
--     Android platform.
--
-- -   URL - The default mobile browser on the recipient\'s device opens
--     and loads the web page at a URL that you specify.
--
-- 'collapseKey', 'gCMMessage_collapseKey' - An arbitrary string that identifies a group of messages that can be
-- collapsed to ensure that only the last message is sent when delivery can
-- resume. This helps avoid sending too many instances of the same messages
-- when the recipient\'s device comes online again or becomes active.
--
-- Amazon Pinpoint specifies this value in the Firebase Cloud Messaging
-- (FCM) collapse_key parameter when it sends the notification message to
-- FCM.
--
-- 'imageUrl', 'gCMMessage_imageUrl' - The URL of an image to display in the push notification.
--
-- 'title', 'gCMMessage_title' - The title to display above the notification message on the recipient\'s
-- device.
--
-- 'iconReference', 'gCMMessage_iconReference' - The icon image name of the asset saved in your app.
newGCMMessage ::
  GCMMessage
newGCMMessage :: GCMMessage
newGCMMessage =
  GCMMessage' :: Maybe (HashMap Text [Text])
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GCMMessage
GCMMessage'
    { $sel:substitutions:GCMMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:silentPush:GCMMessage' :: Maybe Bool
silentPush = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:imageIconUrl:GCMMessage' :: Maybe Text
imageIconUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:GCMMessage' :: Maybe Text
priority = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rawContent:GCMMessage' :: Maybe Text
rawContent = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:data':GCMMessage' :: Maybe (HashMap Text Text)
data' = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:restrictedPackageName:GCMMessage' :: Maybe Text
restrictedPackageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:smallImageIconUrl:GCMMessage' :: Maybe Text
smallImageIconUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:body:GCMMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeToLive:GCMMessage' :: Maybe Int
timeToLive = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:url:GCMMessage' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sound:GCMMessage' :: Maybe Text
sound = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:action:GCMMessage' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
      $sel:collapseKey:GCMMessage' :: Maybe Text
collapseKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageUrl:GCMMessage' :: Maybe Text
imageUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:title:GCMMessage' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:iconReference:GCMMessage' :: Maybe Text
iconReference = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The default message variables to use in the notification message. You
-- can override the default variables with individual address variables.
gCMMessage_substitutions :: Lens.Lens' GCMMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
gCMMessage_substitutions :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> GCMMessage -> f GCMMessage
gCMMessage_substitutions = (GCMMessage -> Maybe (HashMap Text [Text]))
-> (GCMMessage -> Maybe (HashMap Text [Text]) -> GCMMessage)
-> Lens
     GCMMessage
     GCMMessage
     (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 (\GCMMessage' {Maybe (HashMap Text [Text])
substitutions :: Maybe (HashMap Text [Text])
$sel:substitutions:GCMMessage' :: GCMMessage -> Maybe (HashMap Text [Text])
substitutions} -> Maybe (HashMap Text [Text])
substitutions) (\s :: GCMMessage
s@GCMMessage' {} Maybe (HashMap Text [Text])
a -> GCMMessage
s {$sel:substitutions:GCMMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
a} :: GCMMessage) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> GCMMessage -> f GCMMessage)
-> ((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])))
-> GCMMessage
-> f GCMMessage
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, which
-- is a push notification that doesn\'t display on a recipient\'s device.
-- Silent push notifications can be used for cases such as updating an
-- app\'s configuration or supporting phone home functionality.
gCMMessage_silentPush :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Bool)
gCMMessage_silentPush :: (Maybe Bool -> f (Maybe Bool)) -> GCMMessage -> f GCMMessage
gCMMessage_silentPush = (GCMMessage -> Maybe Bool)
-> (GCMMessage -> Maybe Bool -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Bool
silentPush :: Maybe Bool
$sel:silentPush:GCMMessage' :: GCMMessage -> Maybe Bool
silentPush} -> Maybe Bool
silentPush) (\s :: GCMMessage
s@GCMMessage' {} Maybe Bool
a -> GCMMessage
s {$sel:silentPush:GCMMessage' :: Maybe Bool
silentPush = Maybe Bool
a} :: GCMMessage)

-- | The URL of the large icon image to display in the content view of the
-- push notification.
gCMMessage_imageIconUrl :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_imageIconUrl :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_imageIconUrl = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
imageIconUrl :: Maybe Text
$sel:imageIconUrl:GCMMessage' :: GCMMessage -> Maybe Text
imageIconUrl} -> Maybe Text
imageIconUrl) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:imageIconUrl:GCMMessage' :: Maybe Text
imageIconUrl = Maybe Text
a} :: GCMMessage)

-- | para>normal - The notification might be delayed. Delivery is optimized
-- for battery usage on the recipient\'s device. Use this value unless
-- immediate delivery is required.
--
-- \/listitem>
--
-- high - The notification is sent immediately and might wake a sleeping
-- device.
--
-- \/para>
--
-- Amazon Pinpoint specifies this value in the FCM priority parameter when
-- it sends the notification message to FCM.
--
-- The equivalent values for Apple Push Notification service (APNs) are 5,
-- for normal, and 10, for high. If you specify an APNs value for this
-- property, Amazon Pinpoint accepts and converts the value to the
-- corresponding FCM value.
gCMMessage_priority :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_priority :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_priority = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
priority :: Maybe Text
$sel:priority:GCMMessage' :: GCMMessage -> Maybe Text
priority} -> Maybe Text
priority) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:priority:GCMMessage' :: Maybe Text
priority = Maybe Text
a} :: GCMMessage)

-- | 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.
gCMMessage_rawContent :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_rawContent :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_rawContent = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
rawContent :: Maybe Text
$sel:rawContent:GCMMessage' :: GCMMessage -> Maybe Text
rawContent} -> Maybe Text
rawContent) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:rawContent:GCMMessage' :: Maybe Text
rawContent = Maybe Text
a} :: GCMMessage)

-- | The JSON data payload to use for the push notification, if the
-- notification is a silent push notification. This payload is added to the
-- data.pinpoint.jsonBody object of the notification.
gCMMessage_data :: Lens.Lens' GCMMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
gCMMessage_data :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GCMMessage -> f GCMMessage
gCMMessage_data = (GCMMessage -> Maybe (HashMap Text Text))
-> (GCMMessage -> Maybe (HashMap Text Text) -> GCMMessage)
-> Lens
     GCMMessage
     GCMMessage
     (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 (\GCMMessage' {Maybe (HashMap Text Text)
data' :: Maybe (HashMap Text Text)
$sel:data':GCMMessage' :: GCMMessage -> Maybe (HashMap Text Text)
data'} -> Maybe (HashMap Text Text)
data') (\s :: GCMMessage
s@GCMMessage' {} Maybe (HashMap Text Text)
a -> GCMMessage
s {$sel:data':GCMMessage' :: Maybe (HashMap Text Text)
data' = Maybe (HashMap Text Text)
a} :: GCMMessage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> GCMMessage -> f GCMMessage)
-> ((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)))
-> GCMMessage
-> f GCMMessage
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 package name of the application where registration tokens must match
-- in order for the recipient to receive the message.
gCMMessage_restrictedPackageName :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_restrictedPackageName :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_restrictedPackageName = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
restrictedPackageName :: Maybe Text
$sel:restrictedPackageName:GCMMessage' :: GCMMessage -> Maybe Text
restrictedPackageName} -> Maybe Text
restrictedPackageName) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:restrictedPackageName:GCMMessage' :: Maybe Text
restrictedPackageName = Maybe Text
a} :: GCMMessage)

-- | The URL of the small icon image to display in the status bar and the
-- content view of the push notification.
gCMMessage_smallImageIconUrl :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_smallImageIconUrl :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_smallImageIconUrl = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
smallImageIconUrl :: Maybe Text
$sel:smallImageIconUrl:GCMMessage' :: GCMMessage -> Maybe Text
smallImageIconUrl} -> Maybe Text
smallImageIconUrl) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:smallImageIconUrl:GCMMessage' :: Maybe Text
smallImageIconUrl = Maybe Text
a} :: GCMMessage)

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

-- | The amount of time, in seconds, that FCM should store and attempt to
-- deliver the push notification, if the service is unable to deliver the
-- notification the first time. If you don\'t specify this value, FCM
-- defaults to the maximum value, which is 2,419,200 seconds (28 days).
--
-- Amazon Pinpoint specifies this value in the FCM time_to_live parameter
-- when it sends the notification message to FCM.
gCMMessage_timeToLive :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Int)
gCMMessage_timeToLive :: (Maybe Int -> f (Maybe Int)) -> GCMMessage -> f GCMMessage
gCMMessage_timeToLive = (GCMMessage -> Maybe Int)
-> (GCMMessage -> Maybe Int -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Int
timeToLive :: Maybe Int
$sel:timeToLive:GCMMessage' :: GCMMessage -> Maybe Int
timeToLive} -> Maybe Int
timeToLive) (\s :: GCMMessage
s@GCMMessage' {} Maybe Int
a -> GCMMessage
s {$sel:timeToLive:GCMMessage' :: Maybe Int
timeToLive = Maybe Int
a} :: GCMMessage)

-- | 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.
gCMMessage_url :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_url :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_url = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
url :: Maybe Text
$sel:url:GCMMessage' :: GCMMessage -> Maybe Text
url} -> Maybe Text
url) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:url:GCMMessage' :: Maybe Text
url = Maybe Text
a} :: GCMMessage)

-- | The sound to play when the recipient receives the push notification. You
-- can use the default stream or specify the file name of a sound resource
-- that\'s bundled in your app. On an Android platform, the sound file must
-- reside in \/res\/raw\/.
gCMMessage_sound :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_sound :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_sound = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
sound :: Maybe Text
$sel:sound:GCMMessage' :: GCMMessage -> Maybe Text
sound} -> Maybe Text
sound) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:sound:GCMMessage' :: Maybe Text
sound = Maybe Text
a} :: GCMMessage)

-- | 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 action uses the deep-linking features of the
--     Android platform.
--
-- -   URL - The default mobile browser on the recipient\'s device opens
--     and loads the web page at a URL that you specify.
gCMMessage_action :: Lens.Lens' GCMMessage (Prelude.Maybe Action)
gCMMessage_action :: (Maybe Action -> f (Maybe Action)) -> GCMMessage -> f GCMMessage
gCMMessage_action = (GCMMessage -> Maybe Action)
-> (GCMMessage -> Maybe Action -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Action
action :: Maybe Action
$sel:action:GCMMessage' :: GCMMessage -> Maybe Action
action} -> Maybe Action
action) (\s :: GCMMessage
s@GCMMessage' {} Maybe Action
a -> GCMMessage
s {$sel:action:GCMMessage' :: Maybe Action
action = Maybe Action
a} :: GCMMessage)

-- | An arbitrary string that identifies a group of messages that can be
-- collapsed to ensure that only the last message is sent when delivery can
-- resume. This helps avoid sending too many instances of the same messages
-- when the recipient\'s device comes online again or becomes active.
--
-- Amazon Pinpoint specifies this value in the Firebase Cloud Messaging
-- (FCM) collapse_key parameter when it sends the notification message to
-- FCM.
gCMMessage_collapseKey :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_collapseKey :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_collapseKey = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
collapseKey :: Maybe Text
$sel:collapseKey:GCMMessage' :: GCMMessage -> Maybe Text
collapseKey} -> Maybe Text
collapseKey) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:collapseKey:GCMMessage' :: Maybe Text
collapseKey = Maybe Text
a} :: GCMMessage)

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

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

-- | The icon image name of the asset saved in your app.
gCMMessage_iconReference :: Lens.Lens' GCMMessage (Prelude.Maybe Prelude.Text)
gCMMessage_iconReference :: (Maybe Text -> f (Maybe Text)) -> GCMMessage -> f GCMMessage
gCMMessage_iconReference = (GCMMessage -> Maybe Text)
-> (GCMMessage -> Maybe Text -> GCMMessage)
-> Lens GCMMessage GCMMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GCMMessage' {Maybe Text
iconReference :: Maybe Text
$sel:iconReference:GCMMessage' :: GCMMessage -> Maybe Text
iconReference} -> Maybe Text
iconReference) (\s :: GCMMessage
s@GCMMessage' {} Maybe Text
a -> GCMMessage
s {$sel:iconReference:GCMMessage' :: Maybe Text
iconReference = Maybe Text
a} :: GCMMessage)

instance Prelude.Hashable GCMMessage

instance Prelude.NFData GCMMessage

instance Core.ToJSON GCMMessage where
  toJSON :: GCMMessage -> Value
toJSON GCMMessage' {Maybe Bool
Maybe Int
Maybe Text
Maybe (HashMap Text [Text])
Maybe (HashMap Text Text)
Maybe Action
iconReference :: Maybe Text
title :: Maybe Text
imageUrl :: Maybe Text
collapseKey :: Maybe Text
action :: Maybe Action
sound :: Maybe Text
url :: Maybe Text
timeToLive :: Maybe Int
body :: Maybe Text
smallImageIconUrl :: Maybe Text
restrictedPackageName :: Maybe Text
data' :: Maybe (HashMap Text Text)
rawContent :: Maybe Text
priority :: Maybe Text
imageIconUrl :: Maybe Text
silentPush :: Maybe Bool
substitutions :: Maybe (HashMap Text [Text])
$sel:iconReference:GCMMessage' :: GCMMessage -> Maybe Text
$sel:title:GCMMessage' :: GCMMessage -> Maybe Text
$sel:imageUrl:GCMMessage' :: GCMMessage -> Maybe Text
$sel:collapseKey:GCMMessage' :: GCMMessage -> Maybe Text
$sel:action:GCMMessage' :: GCMMessage -> Maybe Action
$sel:sound:GCMMessage' :: GCMMessage -> Maybe Text
$sel:url:GCMMessage' :: GCMMessage -> Maybe Text
$sel:timeToLive:GCMMessage' :: GCMMessage -> Maybe Int
$sel:body:GCMMessage' :: GCMMessage -> Maybe Text
$sel:smallImageIconUrl:GCMMessage' :: GCMMessage -> Maybe Text
$sel:restrictedPackageName:GCMMessage' :: GCMMessage -> Maybe Text
$sel:data':GCMMessage' :: GCMMessage -> Maybe (HashMap Text Text)
$sel:rawContent:GCMMessage' :: GCMMessage -> Maybe Text
$sel:priority:GCMMessage' :: GCMMessage -> Maybe Text
$sel:imageIconUrl:GCMMessage' :: GCMMessage -> Maybe Text
$sel:silentPush:GCMMessage' :: GCMMessage -> Maybe Bool
$sel:substitutions:GCMMessage' :: GCMMessage -> 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
"ImageIconUrl" 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
imageIconUrl,
            (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
"RestrictedPackageName" 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
restrictedPackageName,
            (Text
"SmallImageIconUrl" 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
smallImageIconUrl,
            (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
"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
"CollapseKey" 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
collapseKey,
            (Text
"ImageUrl" 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
imageUrl,
            (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
"IconReference" 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
iconReference
          ]
      )