{-# 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.MessageRequest
-- 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.MessageRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.AddressConfiguration
import Amazonka.Pinpoint.Types.DirectMessageConfiguration
import Amazonka.Pinpoint.Types.EndpointSendConfiguration
import Amazonka.Pinpoint.Types.TemplateConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Specifies the configuration and other settings for a message.
--
-- /See:/ 'newMessageRequest' smart constructor.
data MessageRequest = MessageRequest'
  { -- | The unique identifier for tracing the message. This identifier is
    -- visible to message recipients.
    MessageRequest -> Maybe Text
traceId :: Prelude.Maybe Prelude.Text,
    -- | A map of custom attributes to attach to the message. For a push
    -- notification, this payload is added to the data.pinpoint object. For an
    -- email or text message, this payload is added to email\/SMS delivery
    -- receipt event attributes.
    MessageRequest -> Maybe (HashMap Text Text)
context :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A map of key-value pairs, where each key is an address and each value is
    -- an
    -- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
    -- object. An address can be a push notification token, a phone number, or
    -- an email address. You can use an
    -- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
    -- object to tailor the message for an address by specifying settings such
    -- as content overrides and message variables.
    MessageRequest -> Maybe (HashMap Text AddressConfiguration)
addresses :: Prelude.Maybe (Prelude.HashMap Prelude.Text AddressConfiguration),
    -- | The message template to use for the message.
    MessageRequest -> Maybe TemplateConfiguration
templateConfiguration :: Prelude.Maybe TemplateConfiguration,
    -- | A map of key-value pairs, where each key is an endpoint ID and each
    -- value is an
    -- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
    -- object. You can use an
    -- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
    -- object to tailor the message for an endpoint by specifying settings such
    -- as content overrides and message variables.
    MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints :: Prelude.Maybe (Prelude.HashMap Prelude.Text EndpointSendConfiguration),
    -- | The settings and content for the default message and any default
    -- messages that you defined for specific channels.
    MessageRequest -> DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
  }
  deriving (MessageRequest -> MessageRequest -> Bool
(MessageRequest -> MessageRequest -> Bool)
-> (MessageRequest -> MessageRequest -> Bool) -> Eq MessageRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageRequest -> MessageRequest -> Bool
$c/= :: MessageRequest -> MessageRequest -> Bool
== :: MessageRequest -> MessageRequest -> Bool
$c== :: MessageRequest -> MessageRequest -> Bool
Prelude.Eq, ReadPrec [MessageRequest]
ReadPrec MessageRequest
Int -> ReadS MessageRequest
ReadS [MessageRequest]
(Int -> ReadS MessageRequest)
-> ReadS [MessageRequest]
-> ReadPrec MessageRequest
-> ReadPrec [MessageRequest]
-> Read MessageRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessageRequest]
$creadListPrec :: ReadPrec [MessageRequest]
readPrec :: ReadPrec MessageRequest
$creadPrec :: ReadPrec MessageRequest
readList :: ReadS [MessageRequest]
$creadList :: ReadS [MessageRequest]
readsPrec :: Int -> ReadS MessageRequest
$creadsPrec :: Int -> ReadS MessageRequest
Prelude.Read, Int -> MessageRequest -> ShowS
[MessageRequest] -> ShowS
MessageRequest -> String
(Int -> MessageRequest -> ShowS)
-> (MessageRequest -> String)
-> ([MessageRequest] -> ShowS)
-> Show MessageRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageRequest] -> ShowS
$cshowList :: [MessageRequest] -> ShowS
show :: MessageRequest -> String
$cshow :: MessageRequest -> String
showsPrec :: Int -> MessageRequest -> ShowS
$cshowsPrec :: Int -> MessageRequest -> ShowS
Prelude.Show, (forall x. MessageRequest -> Rep MessageRequest x)
-> (forall x. Rep MessageRequest x -> MessageRequest)
-> Generic MessageRequest
forall x. Rep MessageRequest x -> MessageRequest
forall x. MessageRequest -> Rep MessageRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MessageRequest x -> MessageRequest
$cfrom :: forall x. MessageRequest -> Rep MessageRequest x
Prelude.Generic)

-- |
-- Create a value of 'MessageRequest' 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:
--
-- 'traceId', 'messageRequest_traceId' - The unique identifier for tracing the message. This identifier is
-- visible to message recipients.
--
-- 'context', 'messageRequest_context' - A map of custom attributes to attach to the message. For a push
-- notification, this payload is added to the data.pinpoint object. For an
-- email or text message, this payload is added to email\/SMS delivery
-- receipt event attributes.
--
-- 'addresses', 'messageRequest_addresses' - A map of key-value pairs, where each key is an address and each value is
-- an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
-- object. An address can be a push notification token, a phone number, or
-- an email address. You can use an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
-- object to tailor the message for an address by specifying settings such
-- as content overrides and message variables.
--
-- 'templateConfiguration', 'messageRequest_templateConfiguration' - The message template to use for the message.
--
-- 'endpoints', 'messageRequest_endpoints' - A map of key-value pairs, where each key is an endpoint ID and each
-- value is an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
-- object. You can use an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
-- object to tailor the message for an endpoint by specifying settings such
-- as content overrides and message variables.
--
-- 'messageConfiguration', 'messageRequest_messageConfiguration' - The settings and content for the default message and any default
-- messages that you defined for specific channels.
newMessageRequest ::
  -- | 'messageConfiguration'
  DirectMessageConfiguration ->
  MessageRequest
newMessageRequest :: DirectMessageConfiguration -> MessageRequest
newMessageRequest DirectMessageConfiguration
pMessageConfiguration_ =
  MessageRequest' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text AddressConfiguration)
-> Maybe TemplateConfiguration
-> Maybe (HashMap Text EndpointSendConfiguration)
-> DirectMessageConfiguration
-> MessageRequest
MessageRequest'
    { $sel:traceId:MessageRequest' :: Maybe Text
traceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:context:MessageRequest' :: Maybe (HashMap Text Text)
context = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:addresses:MessageRequest' :: Maybe (HashMap Text AddressConfiguration)
addresses = Maybe (HashMap Text AddressConfiguration)
forall a. Maybe a
Prelude.Nothing,
      $sel:templateConfiguration:MessageRequest' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoints:MessageRequest' :: Maybe (HashMap Text EndpointSendConfiguration)
endpoints = Maybe (HashMap Text EndpointSendConfiguration)
forall a. Maybe a
Prelude.Nothing,
      $sel:messageConfiguration:MessageRequest' :: DirectMessageConfiguration
messageConfiguration = DirectMessageConfiguration
pMessageConfiguration_
    }

-- | The unique identifier for tracing the message. This identifier is
-- visible to message recipients.
messageRequest_traceId :: Lens.Lens' MessageRequest (Prelude.Maybe Prelude.Text)
messageRequest_traceId :: (Maybe Text -> f (Maybe Text))
-> MessageRequest -> f MessageRequest
messageRequest_traceId = (MessageRequest -> Maybe Text)
-> (MessageRequest -> Maybe Text -> MessageRequest)
-> Lens MessageRequest MessageRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe Text
traceId :: Maybe Text
$sel:traceId:MessageRequest' :: MessageRequest -> Maybe Text
traceId} -> Maybe Text
traceId) (\s :: MessageRequest
s@MessageRequest' {} Maybe Text
a -> MessageRequest
s {$sel:traceId:MessageRequest' :: Maybe Text
traceId = Maybe Text
a} :: MessageRequest)

-- | A map of custom attributes to attach to the message. For a push
-- notification, this payload is added to the data.pinpoint object. For an
-- email or text message, this payload is added to email\/SMS delivery
-- receipt event attributes.
messageRequest_context :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
messageRequest_context :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MessageRequest -> f MessageRequest
messageRequest_context = (MessageRequest -> Maybe (HashMap Text Text))
-> (MessageRequest -> Maybe (HashMap Text Text) -> MessageRequest)
-> Lens
     MessageRequest
     MessageRequest
     (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 (\MessageRequest' {Maybe (HashMap Text Text)
context :: Maybe (HashMap Text Text)
$sel:context:MessageRequest' :: MessageRequest -> Maybe (HashMap Text Text)
context} -> Maybe (HashMap Text Text)
context) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text Text)
a -> MessageRequest
s {$sel:context:MessageRequest' :: Maybe (HashMap Text Text)
context = Maybe (HashMap Text Text)
a} :: MessageRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> MessageRequest -> f MessageRequest)
-> ((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)))
-> MessageRequest
-> f MessageRequest
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

-- | A map of key-value pairs, where each key is an address and each value is
-- an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
-- object. An address can be a push notification token, a phone number, or
-- an email address. You can use an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-addressconfiguration AddressConfiguration>
-- object to tailor the message for an address by specifying settings such
-- as content overrides and message variables.
messageRequest_addresses :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text AddressConfiguration))
messageRequest_addresses :: (Maybe (HashMap Text AddressConfiguration)
 -> f (Maybe (HashMap Text AddressConfiguration)))
-> MessageRequest -> f MessageRequest
messageRequest_addresses = (MessageRequest -> Maybe (HashMap Text AddressConfiguration))
-> (MessageRequest
    -> Maybe (HashMap Text AddressConfiguration) -> MessageRequest)
-> Lens
     MessageRequest
     MessageRequest
     (Maybe (HashMap Text AddressConfiguration))
     (Maybe (HashMap Text AddressConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe (HashMap Text AddressConfiguration)
addresses :: Maybe (HashMap Text AddressConfiguration)
$sel:addresses:MessageRequest' :: MessageRequest -> Maybe (HashMap Text AddressConfiguration)
addresses} -> Maybe (HashMap Text AddressConfiguration)
addresses) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text AddressConfiguration)
a -> MessageRequest
s {$sel:addresses:MessageRequest' :: Maybe (HashMap Text AddressConfiguration)
addresses = Maybe (HashMap Text AddressConfiguration)
a} :: MessageRequest) ((Maybe (HashMap Text AddressConfiguration)
  -> f (Maybe (HashMap Text AddressConfiguration)))
 -> MessageRequest -> f MessageRequest)
-> ((Maybe (HashMap Text AddressConfiguration)
     -> f (Maybe (HashMap Text AddressConfiguration)))
    -> Maybe (HashMap Text AddressConfiguration)
    -> f (Maybe (HashMap Text AddressConfiguration)))
-> (Maybe (HashMap Text AddressConfiguration)
    -> f (Maybe (HashMap Text AddressConfiguration)))
-> MessageRequest
-> f MessageRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text AddressConfiguration)
  (HashMap Text AddressConfiguration)
  (HashMap Text AddressConfiguration)
  (HashMap Text AddressConfiguration)
-> Iso
     (Maybe (HashMap Text AddressConfiguration))
     (Maybe (HashMap Text AddressConfiguration))
     (Maybe (HashMap Text AddressConfiguration))
     (Maybe (HashMap Text AddressConfiguration))
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 AddressConfiguration)
  (HashMap Text AddressConfiguration)
  (HashMap Text AddressConfiguration)
  (HashMap Text AddressConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The message template to use for the message.
messageRequest_templateConfiguration :: Lens.Lens' MessageRequest (Prelude.Maybe TemplateConfiguration)
messageRequest_templateConfiguration :: (Maybe TemplateConfiguration -> f (Maybe TemplateConfiguration))
-> MessageRequest -> f MessageRequest
messageRequest_templateConfiguration = (MessageRequest -> Maybe TemplateConfiguration)
-> (MessageRequest
    -> Maybe TemplateConfiguration -> MessageRequest)
-> Lens
     MessageRequest
     MessageRequest
     (Maybe TemplateConfiguration)
     (Maybe TemplateConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe TemplateConfiguration
templateConfiguration :: Maybe TemplateConfiguration
$sel:templateConfiguration:MessageRequest' :: MessageRequest -> Maybe TemplateConfiguration
templateConfiguration} -> Maybe TemplateConfiguration
templateConfiguration) (\s :: MessageRequest
s@MessageRequest' {} Maybe TemplateConfiguration
a -> MessageRequest
s {$sel:templateConfiguration:MessageRequest' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
a} :: MessageRequest)

-- | A map of key-value pairs, where each key is an endpoint ID and each
-- value is an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
-- object. You can use an
-- <https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#apps-application-id-messages-model-endpointsendconfiguration EndpointSendConfiguration>
-- object to tailor the message for an endpoint by specifying settings such
-- as content overrides and message variables.
messageRequest_endpoints :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text EndpointSendConfiguration))
messageRequest_endpoints :: (Maybe (HashMap Text EndpointSendConfiguration)
 -> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> MessageRequest -> f MessageRequest
messageRequest_endpoints = (MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration))
-> (MessageRequest
    -> Maybe (HashMap Text EndpointSendConfiguration)
    -> MessageRequest)
-> Lens
     MessageRequest
     MessageRequest
     (Maybe (HashMap Text EndpointSendConfiguration))
     (Maybe (HashMap Text EndpointSendConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe (HashMap Text EndpointSendConfiguration)
endpoints :: Maybe (HashMap Text EndpointSendConfiguration)
$sel:endpoints:MessageRequest' :: MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints} -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text EndpointSendConfiguration)
a -> MessageRequest
s {$sel:endpoints:MessageRequest' :: Maybe (HashMap Text EndpointSendConfiguration)
endpoints = Maybe (HashMap Text EndpointSendConfiguration)
a} :: MessageRequest) ((Maybe (HashMap Text EndpointSendConfiguration)
  -> f (Maybe (HashMap Text EndpointSendConfiguration)))
 -> MessageRequest -> f MessageRequest)
-> ((Maybe (HashMap Text EndpointSendConfiguration)
     -> f (Maybe (HashMap Text EndpointSendConfiguration)))
    -> Maybe (HashMap Text EndpointSendConfiguration)
    -> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> (Maybe (HashMap Text EndpointSendConfiguration)
    -> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> MessageRequest
-> f MessageRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
-> Iso
     (Maybe (HashMap Text EndpointSendConfiguration))
     (Maybe (HashMap Text EndpointSendConfiguration))
     (Maybe (HashMap Text EndpointSendConfiguration))
     (Maybe (HashMap Text EndpointSendConfiguration))
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 EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
  (HashMap Text EndpointSendConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The settings and content for the default message and any default
-- messages that you defined for specific channels.
messageRequest_messageConfiguration :: Lens.Lens' MessageRequest DirectMessageConfiguration
messageRequest_messageConfiguration :: (DirectMessageConfiguration -> f DirectMessageConfiguration)
-> MessageRequest -> f MessageRequest
messageRequest_messageConfiguration = (MessageRequest -> DirectMessageConfiguration)
-> (MessageRequest -> DirectMessageConfiguration -> MessageRequest)
-> Lens
     MessageRequest
     MessageRequest
     DirectMessageConfiguration
     DirectMessageConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
$sel:messageConfiguration:MessageRequest' :: MessageRequest -> DirectMessageConfiguration
messageConfiguration} -> DirectMessageConfiguration
messageConfiguration) (\s :: MessageRequest
s@MessageRequest' {} DirectMessageConfiguration
a -> MessageRequest
s {$sel:messageConfiguration:MessageRequest' :: DirectMessageConfiguration
messageConfiguration = DirectMessageConfiguration
a} :: MessageRequest)

instance Prelude.Hashable MessageRequest

instance Prelude.NFData MessageRequest

instance Core.ToJSON MessageRequest where
  toJSON :: MessageRequest -> Value
toJSON MessageRequest' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AddressConfiguration)
Maybe (HashMap Text EndpointSendConfiguration)
Maybe TemplateConfiguration
DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
endpoints :: Maybe (HashMap Text EndpointSendConfiguration)
templateConfiguration :: Maybe TemplateConfiguration
addresses :: Maybe (HashMap Text AddressConfiguration)
context :: Maybe (HashMap Text Text)
traceId :: Maybe Text
$sel:messageConfiguration:MessageRequest' :: MessageRequest -> DirectMessageConfiguration
$sel:endpoints:MessageRequest' :: MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
$sel:templateConfiguration:MessageRequest' :: MessageRequest -> Maybe TemplateConfiguration
$sel:addresses:MessageRequest' :: MessageRequest -> Maybe (HashMap Text AddressConfiguration)
$sel:context:MessageRequest' :: MessageRequest -> Maybe (HashMap Text Text)
$sel:traceId:MessageRequest' :: MessageRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TraceId" 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
traceId,
            (Text
"Context" 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)
context,
            (Text
"Addresses" Text -> HashMap Text AddressConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text AddressConfiguration -> Pair)
-> Maybe (HashMap Text AddressConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AddressConfiguration)
addresses,
            (Text
"TemplateConfiguration" Text -> TemplateConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TemplateConfiguration -> Pair)
-> Maybe TemplateConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TemplateConfiguration
templateConfiguration,
            (Text
"Endpoints" Text -> HashMap Text EndpointSendConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text EndpointSendConfiguration -> Pair)
-> Maybe (HashMap Text EndpointSendConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text EndpointSendConfiguration)
endpoints,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"MessageConfiguration"
                  Text -> DirectMessageConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DirectMessageConfiguration
messageConfiguration
              )
          ]
      )