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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.ChannelType
import Amazonka.Pinpoint.Types.EndpointDemographic
import Amazonka.Pinpoint.Types.EndpointLocation
import Amazonka.Pinpoint.Types.EndpointUser
import qualified Amazonka.Prelude as Prelude

-- | Specifies the channel type and other settings for an endpoint.
--
-- /See:/ 'newEndpointRequest' smart constructor.
data EndpointRequest = EndpointRequest'
  { -- | The unique identifier for the most recent request to update the
    -- endpoint.
    EndpointRequest -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | One or more custom metrics that your app reports to Amazon Pinpoint for
    -- the endpoint.
    EndpointRequest -> Maybe (HashMap Text Double)
metrics :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
    -- | The geographic information for the endpoint.
    EndpointRequest -> Maybe EndpointLocation
location :: Prelude.Maybe EndpointLocation,
    -- | The demographic information for the endpoint, such as the time zone and
    -- platform.
    EndpointRequest -> Maybe EndpointDemographic
demographic :: Prelude.Maybe EndpointDemographic,
    -- | The destination address for messages or push notifications that you send
    -- to the endpoint. The address varies by channel. For a push-notification
    -- channel, use the token provided by the push notification service, such
    -- as an Apple Push Notification service (APNs) device token or a Firebase
    -- Cloud Messaging (FCM) registration token. For the SMS channel, use a
    -- phone number in E.164 format, such as +12065550100. For the email
    -- channel, use an email address.
    EndpointRequest -> Maybe Text
address :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in ISO 8601 format, when the endpoint is updated.
    EndpointRequest -> Maybe Text
effectiveDate :: Prelude.Maybe Prelude.Text,
    -- | One or more custom attributes that describe the user who\'s associated
    -- with the endpoint.
    EndpointRequest -> Maybe EndpointUser
user :: Prelude.Maybe EndpointUser,
    -- | One or more custom attributes that describe the endpoint by associating
    -- a name with an array of values. For example, the value of a custom
    -- attribute named Interests might be: [\"Science\", \"Music\",
    -- \"Travel\"]. You can use these attributes as filter criteria when you
    -- create segments. Attribute names are case sensitive.
    --
    -- An attribute name can contain up to 50 characters. An attribute value
    -- can contain up to 100 characters. When you define the name of a custom
    -- attribute, avoid using the following characters: number sign (#), colon
    -- (:), question mark (?), backslash (\\), and slash (\/). The Amazon
    -- Pinpoint console can\'t display attribute names that contain these
    -- characters. This restriction doesn\'t apply to attribute values.
    EndpointRequest -> Maybe (HashMap Text [Text])
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | Specifies whether to send messages or push notifications to the
    -- endpoint. Valid values are: ACTIVE, messages are sent to the endpoint;
    -- and, INACTIVE, messages aren’t sent to the endpoint.
    --
    -- Amazon Pinpoint automatically sets this value to ACTIVE when you create
    -- an endpoint or update an existing endpoint. Amazon Pinpoint
    -- automatically sets this value to INACTIVE if you update another endpoint
    -- that has the same address specified by the Address property.
    EndpointRequest -> Maybe Text
endpointStatus :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the user who\'s associated with the endpoint has opted
    -- out of receiving messages and push notifications from you. Possible
    -- values are: ALL, the user has opted out and doesn\'t want to receive any
    -- messages or push notifications; and, NONE, the user hasn\'t opted out
    -- and wants to receive all messages and push notifications.
    EndpointRequest -> Maybe Text
optOut :: Prelude.Maybe Prelude.Text,
    -- | The channel to use when sending messages or push notifications to the
    -- endpoint.
    EndpointRequest -> Maybe ChannelType
channelType :: Prelude.Maybe ChannelType
  }
  deriving (EndpointRequest -> EndpointRequest -> Bool
(EndpointRequest -> EndpointRequest -> Bool)
-> (EndpointRequest -> EndpointRequest -> Bool)
-> Eq EndpointRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointRequest -> EndpointRequest -> Bool
$c/= :: EndpointRequest -> EndpointRequest -> Bool
== :: EndpointRequest -> EndpointRequest -> Bool
$c== :: EndpointRequest -> EndpointRequest -> Bool
Prelude.Eq, ReadPrec [EndpointRequest]
ReadPrec EndpointRequest
Int -> ReadS EndpointRequest
ReadS [EndpointRequest]
(Int -> ReadS EndpointRequest)
-> ReadS [EndpointRequest]
-> ReadPrec EndpointRequest
-> ReadPrec [EndpointRequest]
-> Read EndpointRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointRequest]
$creadListPrec :: ReadPrec [EndpointRequest]
readPrec :: ReadPrec EndpointRequest
$creadPrec :: ReadPrec EndpointRequest
readList :: ReadS [EndpointRequest]
$creadList :: ReadS [EndpointRequest]
readsPrec :: Int -> ReadS EndpointRequest
$creadsPrec :: Int -> ReadS EndpointRequest
Prelude.Read, Int -> EndpointRequest -> ShowS
[EndpointRequest] -> ShowS
EndpointRequest -> String
(Int -> EndpointRequest -> ShowS)
-> (EndpointRequest -> String)
-> ([EndpointRequest] -> ShowS)
-> Show EndpointRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointRequest] -> ShowS
$cshowList :: [EndpointRequest] -> ShowS
show :: EndpointRequest -> String
$cshow :: EndpointRequest -> String
showsPrec :: Int -> EndpointRequest -> ShowS
$cshowsPrec :: Int -> EndpointRequest -> ShowS
Prelude.Show, (forall x. EndpointRequest -> Rep EndpointRequest x)
-> (forall x. Rep EndpointRequest x -> EndpointRequest)
-> Generic EndpointRequest
forall x. Rep EndpointRequest x -> EndpointRequest
forall x. EndpointRequest -> Rep EndpointRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointRequest x -> EndpointRequest
$cfrom :: forall x. EndpointRequest -> Rep EndpointRequest x
Prelude.Generic)

-- |
-- Create a value of 'EndpointRequest' 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:
--
-- 'requestId', 'endpointRequest_requestId' - The unique identifier for the most recent request to update the
-- endpoint.
--
-- 'metrics', 'endpointRequest_metrics' - One or more custom metrics that your app reports to Amazon Pinpoint for
-- the endpoint.
--
-- 'location', 'endpointRequest_location' - The geographic information for the endpoint.
--
-- 'demographic', 'endpointRequest_demographic' - The demographic information for the endpoint, such as the time zone and
-- platform.
--
-- 'address', 'endpointRequest_address' - The destination address for messages or push notifications that you send
-- to the endpoint. The address varies by channel. For a push-notification
-- channel, use the token provided by the push notification service, such
-- as an Apple Push Notification service (APNs) device token or a Firebase
-- Cloud Messaging (FCM) registration token. For the SMS channel, use a
-- phone number in E.164 format, such as +12065550100. For the email
-- channel, use an email address.
--
-- 'effectiveDate', 'endpointRequest_effectiveDate' - The date and time, in ISO 8601 format, when the endpoint is updated.
--
-- 'user', 'endpointRequest_user' - One or more custom attributes that describe the user who\'s associated
-- with the endpoint.
--
-- 'attributes', 'endpointRequest_attributes' - One or more custom attributes that describe the endpoint by associating
-- a name with an array of values. For example, the value of a custom
-- attribute named Interests might be: [\"Science\", \"Music\",
-- \"Travel\"]. You can use these attributes as filter criteria when you
-- create segments. Attribute names are case sensitive.
--
-- An attribute name can contain up to 50 characters. An attribute value
-- can contain up to 100 characters. When you define the name of a custom
-- attribute, avoid using the following characters: number sign (#), colon
-- (:), question mark (?), backslash (\\), and slash (\/). The Amazon
-- Pinpoint console can\'t display attribute names that contain these
-- characters. This restriction doesn\'t apply to attribute values.
--
-- 'endpointStatus', 'endpointRequest_endpointStatus' - Specifies whether to send messages or push notifications to the
-- endpoint. Valid values are: ACTIVE, messages are sent to the endpoint;
-- and, INACTIVE, messages aren’t sent to the endpoint.
--
-- Amazon Pinpoint automatically sets this value to ACTIVE when you create
-- an endpoint or update an existing endpoint. Amazon Pinpoint
-- automatically sets this value to INACTIVE if you update another endpoint
-- that has the same address specified by the Address property.
--
-- 'optOut', 'endpointRequest_optOut' - Specifies whether the user who\'s associated with the endpoint has opted
-- out of receiving messages and push notifications from you. Possible
-- values are: ALL, the user has opted out and doesn\'t want to receive any
-- messages or push notifications; and, NONE, the user hasn\'t opted out
-- and wants to receive all messages and push notifications.
--
-- 'channelType', 'endpointRequest_channelType' - The channel to use when sending messages or push notifications to the
-- endpoint.
newEndpointRequest ::
  EndpointRequest
newEndpointRequest :: EndpointRequest
newEndpointRequest =
  EndpointRequest' :: Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe EndpointLocation
-> Maybe EndpointDemographic
-> Maybe Text
-> Maybe Text
-> Maybe EndpointUser
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe Text
-> Maybe ChannelType
-> EndpointRequest
EndpointRequest'
    { $sel:requestId:EndpointRequest' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metrics:EndpointRequest' :: Maybe (HashMap Text Double)
metrics = Maybe (HashMap Text Double)
forall a. Maybe a
Prelude.Nothing,
      $sel:location:EndpointRequest' :: Maybe EndpointLocation
location = Maybe EndpointLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:demographic:EndpointRequest' :: Maybe EndpointDemographic
demographic = Maybe EndpointDemographic
forall a. Maybe a
Prelude.Nothing,
      $sel:address:EndpointRequest' :: Maybe Text
address = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:effectiveDate:EndpointRequest' :: Maybe Text
effectiveDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:user:EndpointRequest' :: Maybe EndpointUser
user = Maybe EndpointUser
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:EndpointRequest' :: Maybe (HashMap Text [Text])
attributes = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointStatus:EndpointRequest' :: Maybe Text
endpointStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:optOut:EndpointRequest' :: Maybe Text
optOut = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelType:EndpointRequest' :: Maybe ChannelType
channelType = Maybe ChannelType
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier for the most recent request to update the
-- endpoint.
endpointRequest_requestId :: Lens.Lens' EndpointRequest (Prelude.Maybe Prelude.Text)
endpointRequest_requestId :: (Maybe Text -> f (Maybe Text))
-> EndpointRequest -> f EndpointRequest
endpointRequest_requestId = (EndpointRequest -> Maybe Text)
-> (EndpointRequest -> Maybe Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe Text
requestId :: Maybe Text
$sel:requestId:EndpointRequest' :: EndpointRequest -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe Text
a -> EndpointRequest
s {$sel:requestId:EndpointRequest' :: Maybe Text
requestId = Maybe Text
a} :: EndpointRequest)

-- | One or more custom metrics that your app reports to Amazon Pinpoint for
-- the endpoint.
endpointRequest_metrics :: Lens.Lens' EndpointRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
endpointRequest_metrics :: (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> EndpointRequest -> f EndpointRequest
endpointRequest_metrics = (EndpointRequest -> Maybe (HashMap Text Double))
-> (EndpointRequest
    -> Maybe (HashMap Text Double) -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (Maybe (HashMap Text Double))
     (Maybe (HashMap Text Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe (HashMap Text Double)
metrics :: Maybe (HashMap Text Double)
$sel:metrics:EndpointRequest' :: EndpointRequest -> Maybe (HashMap Text Double)
metrics} -> Maybe (HashMap Text Double)
metrics) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe (HashMap Text Double)
a -> EndpointRequest
s {$sel:metrics:EndpointRequest' :: Maybe (HashMap Text Double)
metrics = Maybe (HashMap Text Double)
a} :: EndpointRequest) ((Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
 -> EndpointRequest -> f EndpointRequest)
-> ((Maybe (HashMap Text Double)
     -> f (Maybe (HashMap Text Double)))
    -> Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> EndpointRequest
-> f EndpointRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Double)
  (HashMap Text Double)
  (HashMap Text Double)
  (HashMap Text Double)
-> Iso
     (Maybe (HashMap Text Double))
     (Maybe (HashMap Text Double))
     (Maybe (HashMap Text Double))
     (Maybe (HashMap Text Double))
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 Double)
  (HashMap Text Double)
  (HashMap Text Double)
  (HashMap Text Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The geographic information for the endpoint.
endpointRequest_location :: Lens.Lens' EndpointRequest (Prelude.Maybe EndpointLocation)
endpointRequest_location :: (Maybe EndpointLocation -> f (Maybe EndpointLocation))
-> EndpointRequest -> f EndpointRequest
endpointRequest_location = (EndpointRequest -> Maybe EndpointLocation)
-> (EndpointRequest -> Maybe EndpointLocation -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (Maybe EndpointLocation)
     (Maybe EndpointLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe EndpointLocation
location :: Maybe EndpointLocation
$sel:location:EndpointRequest' :: EndpointRequest -> Maybe EndpointLocation
location} -> Maybe EndpointLocation
location) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe EndpointLocation
a -> EndpointRequest
s {$sel:location:EndpointRequest' :: Maybe EndpointLocation
location = Maybe EndpointLocation
a} :: EndpointRequest)

-- | The demographic information for the endpoint, such as the time zone and
-- platform.
endpointRequest_demographic :: Lens.Lens' EndpointRequest (Prelude.Maybe EndpointDemographic)
endpointRequest_demographic :: (Maybe EndpointDemographic -> f (Maybe EndpointDemographic))
-> EndpointRequest -> f EndpointRequest
endpointRequest_demographic = (EndpointRequest -> Maybe EndpointDemographic)
-> (EndpointRequest
    -> Maybe EndpointDemographic -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (Maybe EndpointDemographic)
     (Maybe EndpointDemographic)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe EndpointDemographic
demographic :: Maybe EndpointDemographic
$sel:demographic:EndpointRequest' :: EndpointRequest -> Maybe EndpointDemographic
demographic} -> Maybe EndpointDemographic
demographic) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe EndpointDemographic
a -> EndpointRequest
s {$sel:demographic:EndpointRequest' :: Maybe EndpointDemographic
demographic = Maybe EndpointDemographic
a} :: EndpointRequest)

-- | The destination address for messages or push notifications that you send
-- to the endpoint. The address varies by channel. For a push-notification
-- channel, use the token provided by the push notification service, such
-- as an Apple Push Notification service (APNs) device token or a Firebase
-- Cloud Messaging (FCM) registration token. For the SMS channel, use a
-- phone number in E.164 format, such as +12065550100. For the email
-- channel, use an email address.
endpointRequest_address :: Lens.Lens' EndpointRequest (Prelude.Maybe Prelude.Text)
endpointRequest_address :: (Maybe Text -> f (Maybe Text))
-> EndpointRequest -> f EndpointRequest
endpointRequest_address = (EndpointRequest -> Maybe Text)
-> (EndpointRequest -> Maybe Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe Text
address :: Maybe Text
$sel:address:EndpointRequest' :: EndpointRequest -> Maybe Text
address} -> Maybe Text
address) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe Text
a -> EndpointRequest
s {$sel:address:EndpointRequest' :: Maybe Text
address = Maybe Text
a} :: EndpointRequest)

-- | The date and time, in ISO 8601 format, when the endpoint is updated.
endpointRequest_effectiveDate :: Lens.Lens' EndpointRequest (Prelude.Maybe Prelude.Text)
endpointRequest_effectiveDate :: (Maybe Text -> f (Maybe Text))
-> EndpointRequest -> f EndpointRequest
endpointRequest_effectiveDate = (EndpointRequest -> Maybe Text)
-> (EndpointRequest -> Maybe Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe Text
effectiveDate :: Maybe Text
$sel:effectiveDate:EndpointRequest' :: EndpointRequest -> Maybe Text
effectiveDate} -> Maybe Text
effectiveDate) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe Text
a -> EndpointRequest
s {$sel:effectiveDate:EndpointRequest' :: Maybe Text
effectiveDate = Maybe Text
a} :: EndpointRequest)

-- | One or more custom attributes that describe the user who\'s associated
-- with the endpoint.
endpointRequest_user :: Lens.Lens' EndpointRequest (Prelude.Maybe EndpointUser)
endpointRequest_user :: (Maybe EndpointUser -> f (Maybe EndpointUser))
-> EndpointRequest -> f EndpointRequest
endpointRequest_user = (EndpointRequest -> Maybe EndpointUser)
-> (EndpointRequest -> Maybe EndpointUser -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (Maybe EndpointUser)
     (Maybe EndpointUser)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe EndpointUser
user :: Maybe EndpointUser
$sel:user:EndpointRequest' :: EndpointRequest -> Maybe EndpointUser
user} -> Maybe EndpointUser
user) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe EndpointUser
a -> EndpointRequest
s {$sel:user:EndpointRequest' :: Maybe EndpointUser
user = Maybe EndpointUser
a} :: EndpointRequest)

-- | One or more custom attributes that describe the endpoint by associating
-- a name with an array of values. For example, the value of a custom
-- attribute named Interests might be: [\"Science\", \"Music\",
-- \"Travel\"]. You can use these attributes as filter criteria when you
-- create segments. Attribute names are case sensitive.
--
-- An attribute name can contain up to 50 characters. An attribute value
-- can contain up to 100 characters. When you define the name of a custom
-- attribute, avoid using the following characters: number sign (#), colon
-- (:), question mark (?), backslash (\\), and slash (\/). The Amazon
-- Pinpoint console can\'t display attribute names that contain these
-- characters. This restriction doesn\'t apply to attribute values.
endpointRequest_attributes :: Lens.Lens' EndpointRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
endpointRequest_attributes :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EndpointRequest -> f EndpointRequest
endpointRequest_attributes = (EndpointRequest -> Maybe (HashMap Text [Text]))
-> (EndpointRequest
    -> Maybe (HashMap Text [Text]) -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (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 (\EndpointRequest' {Maybe (HashMap Text [Text])
attributes :: Maybe (HashMap Text [Text])
$sel:attributes:EndpointRequest' :: EndpointRequest -> Maybe (HashMap Text [Text])
attributes} -> Maybe (HashMap Text [Text])
attributes) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe (HashMap Text [Text])
a -> EndpointRequest
s {$sel:attributes:EndpointRequest' :: Maybe (HashMap Text [Text])
attributes = Maybe (HashMap Text [Text])
a} :: EndpointRequest) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> EndpointRequest -> f EndpointRequest)
-> ((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])))
-> EndpointRequest
-> f EndpointRequest
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 to send messages or push notifications to the
-- endpoint. Valid values are: ACTIVE, messages are sent to the endpoint;
-- and, INACTIVE, messages aren’t sent to the endpoint.
--
-- Amazon Pinpoint automatically sets this value to ACTIVE when you create
-- an endpoint or update an existing endpoint. Amazon Pinpoint
-- automatically sets this value to INACTIVE if you update another endpoint
-- that has the same address specified by the Address property.
endpointRequest_endpointStatus :: Lens.Lens' EndpointRequest (Prelude.Maybe Prelude.Text)
endpointRequest_endpointStatus :: (Maybe Text -> f (Maybe Text))
-> EndpointRequest -> f EndpointRequest
endpointRequest_endpointStatus = (EndpointRequest -> Maybe Text)
-> (EndpointRequest -> Maybe Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe Text
endpointStatus :: Maybe Text
$sel:endpointStatus:EndpointRequest' :: EndpointRequest -> Maybe Text
endpointStatus} -> Maybe Text
endpointStatus) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe Text
a -> EndpointRequest
s {$sel:endpointStatus:EndpointRequest' :: Maybe Text
endpointStatus = Maybe Text
a} :: EndpointRequest)

-- | Specifies whether the user who\'s associated with the endpoint has opted
-- out of receiving messages and push notifications from you. Possible
-- values are: ALL, the user has opted out and doesn\'t want to receive any
-- messages or push notifications; and, NONE, the user hasn\'t opted out
-- and wants to receive all messages and push notifications.
endpointRequest_optOut :: Lens.Lens' EndpointRequest (Prelude.Maybe Prelude.Text)
endpointRequest_optOut :: (Maybe Text -> f (Maybe Text))
-> EndpointRequest -> f EndpointRequest
endpointRequest_optOut = (EndpointRequest -> Maybe Text)
-> (EndpointRequest -> Maybe Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe Text
optOut :: Maybe Text
$sel:optOut:EndpointRequest' :: EndpointRequest -> Maybe Text
optOut} -> Maybe Text
optOut) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe Text
a -> EndpointRequest
s {$sel:optOut:EndpointRequest' :: Maybe Text
optOut = Maybe Text
a} :: EndpointRequest)

-- | The channel to use when sending messages or push notifications to the
-- endpoint.
endpointRequest_channelType :: Lens.Lens' EndpointRequest (Prelude.Maybe ChannelType)
endpointRequest_channelType :: (Maybe ChannelType -> f (Maybe ChannelType))
-> EndpointRequest -> f EndpointRequest
endpointRequest_channelType = (EndpointRequest -> Maybe ChannelType)
-> (EndpointRequest -> Maybe ChannelType -> EndpointRequest)
-> Lens
     EndpointRequest
     EndpointRequest
     (Maybe ChannelType)
     (Maybe ChannelType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe ChannelType
channelType :: Maybe ChannelType
$sel:channelType:EndpointRequest' :: EndpointRequest -> Maybe ChannelType
channelType} -> Maybe ChannelType
channelType) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe ChannelType
a -> EndpointRequest
s {$sel:channelType:EndpointRequest' :: Maybe ChannelType
channelType = Maybe ChannelType
a} :: EndpointRequest)

instance Prelude.Hashable EndpointRequest

instance Prelude.NFData EndpointRequest

instance Core.ToJSON EndpointRequest where
  toJSON :: EndpointRequest -> Value
toJSON EndpointRequest' {Maybe Text
Maybe (HashMap Text Double)
Maybe (HashMap Text [Text])
Maybe ChannelType
Maybe EndpointDemographic
Maybe EndpointLocation
Maybe EndpointUser
channelType :: Maybe ChannelType
optOut :: Maybe Text
endpointStatus :: Maybe Text
attributes :: Maybe (HashMap Text [Text])
user :: Maybe EndpointUser
effectiveDate :: Maybe Text
address :: Maybe Text
demographic :: Maybe EndpointDemographic
location :: Maybe EndpointLocation
metrics :: Maybe (HashMap Text Double)
requestId :: Maybe Text
$sel:channelType:EndpointRequest' :: EndpointRequest -> Maybe ChannelType
$sel:optOut:EndpointRequest' :: EndpointRequest -> Maybe Text
$sel:endpointStatus:EndpointRequest' :: EndpointRequest -> Maybe Text
$sel:attributes:EndpointRequest' :: EndpointRequest -> Maybe (HashMap Text [Text])
$sel:user:EndpointRequest' :: EndpointRequest -> Maybe EndpointUser
$sel:effectiveDate:EndpointRequest' :: EndpointRequest -> Maybe Text
$sel:address:EndpointRequest' :: EndpointRequest -> Maybe Text
$sel:demographic:EndpointRequest' :: EndpointRequest -> Maybe EndpointDemographic
$sel:location:EndpointRequest' :: EndpointRequest -> Maybe EndpointLocation
$sel:metrics:EndpointRequest' :: EndpointRequest -> Maybe (HashMap Text Double)
$sel:requestId:EndpointRequest' :: EndpointRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RequestId" 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
requestId,
            (Text
"Metrics" Text -> HashMap Text Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Double -> Pair)
-> Maybe (HashMap Text Double) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Double)
metrics,
            (Text
"Location" Text -> EndpointLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointLocation -> Pair) -> Maybe EndpointLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointLocation
location,
            (Text
"Demographic" Text -> EndpointDemographic -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointDemographic -> Pair)
-> Maybe EndpointDemographic -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointDemographic
demographic,
            (Text
"Address" 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
address,
            (Text
"EffectiveDate" 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
effectiveDate,
            (Text
"User" Text -> EndpointUser -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointUser -> Pair) -> Maybe EndpointUser -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointUser
user,
            (Text
"Attributes" 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])
attributes,
            (Text
"EndpointStatus" 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
endpointStatus,
            (Text
"OptOut" 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
optOut,
            (Text
"ChannelType" Text -> ChannelType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChannelType -> Pair) -> Maybe ChannelType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelType
channelType
          ]
      )