{-# 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.PublicEndpoint
-- 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.PublicEndpoint 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 properties and attributes of an endpoint that\'s
-- associated with an event.
--
-- /See:/ 'newPublicEndpoint' smart constructor.
data PublicEndpoint = PublicEndpoint'
  { -- | A unique identifier that\'s generated each time the endpoint is updated.
    PublicEndpoint -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | One or more custom metrics that your app reports to Amazon Pinpoint for
    -- the endpoint.
    PublicEndpoint -> Maybe (HashMap Text Double)
metrics :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
    -- | The geographic information for the endpoint.
    PublicEndpoint -> Maybe EndpointLocation
location :: Prelude.Maybe EndpointLocation,
    -- | The demographic information for the endpoint, such as the time zone and
    -- platform.
    PublicEndpoint -> Maybe EndpointDemographic
demographic :: Prelude.Maybe EndpointDemographic,
    -- | The unique identifier for the recipient, such as a device token, email
    -- address, or mobile phone number.
    PublicEndpoint -> Maybe Text
address :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in ISO 8601 format, when the endpoint was last
    -- updated.
    PublicEndpoint -> Maybe Text
effectiveDate :: Prelude.Maybe Prelude.Text,
    -- | One or more custom user attributes that your app reports to Amazon
    -- Pinpoint for the user who\'s associated with the endpoint.
    PublicEndpoint -> Maybe EndpointUser
user :: Prelude.Maybe EndpointUser,
    -- | One or more custom attributes that describe the endpoint by associating
    -- a name with an array of values. You can use these attributes as filter
    -- criteria when you create segments.
    PublicEndpoint -> 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.
    PublicEndpoint -> 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.
    PublicEndpoint -> Maybe Text
optOut :: Prelude.Maybe Prelude.Text,
    -- | The channel that\'s used when sending messages or push notifications to
    -- the endpoint.
    PublicEndpoint -> Maybe ChannelType
channelType :: Prelude.Maybe ChannelType
  }
  deriving (PublicEndpoint -> PublicEndpoint -> Bool
(PublicEndpoint -> PublicEndpoint -> Bool)
-> (PublicEndpoint -> PublicEndpoint -> Bool) -> Eq PublicEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublicEndpoint -> PublicEndpoint -> Bool
$c/= :: PublicEndpoint -> PublicEndpoint -> Bool
== :: PublicEndpoint -> PublicEndpoint -> Bool
$c== :: PublicEndpoint -> PublicEndpoint -> Bool
Prelude.Eq, ReadPrec [PublicEndpoint]
ReadPrec PublicEndpoint
Int -> ReadS PublicEndpoint
ReadS [PublicEndpoint]
(Int -> ReadS PublicEndpoint)
-> ReadS [PublicEndpoint]
-> ReadPrec PublicEndpoint
-> ReadPrec [PublicEndpoint]
-> Read PublicEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublicEndpoint]
$creadListPrec :: ReadPrec [PublicEndpoint]
readPrec :: ReadPrec PublicEndpoint
$creadPrec :: ReadPrec PublicEndpoint
readList :: ReadS [PublicEndpoint]
$creadList :: ReadS [PublicEndpoint]
readsPrec :: Int -> ReadS PublicEndpoint
$creadsPrec :: Int -> ReadS PublicEndpoint
Prelude.Read, Int -> PublicEndpoint -> ShowS
[PublicEndpoint] -> ShowS
PublicEndpoint -> String
(Int -> PublicEndpoint -> ShowS)
-> (PublicEndpoint -> String)
-> ([PublicEndpoint] -> ShowS)
-> Show PublicEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublicEndpoint] -> ShowS
$cshowList :: [PublicEndpoint] -> ShowS
show :: PublicEndpoint -> String
$cshow :: PublicEndpoint -> String
showsPrec :: Int -> PublicEndpoint -> ShowS
$cshowsPrec :: Int -> PublicEndpoint -> ShowS
Prelude.Show, (forall x. PublicEndpoint -> Rep PublicEndpoint x)
-> (forall x. Rep PublicEndpoint x -> PublicEndpoint)
-> Generic PublicEndpoint
forall x. Rep PublicEndpoint x -> PublicEndpoint
forall x. PublicEndpoint -> Rep PublicEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublicEndpoint x -> PublicEndpoint
$cfrom :: forall x. PublicEndpoint -> Rep PublicEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'PublicEndpoint' 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', 'publicEndpoint_requestId' - A unique identifier that\'s generated each time the endpoint is updated.
--
-- 'metrics', 'publicEndpoint_metrics' - One or more custom metrics that your app reports to Amazon Pinpoint for
-- the endpoint.
--
-- 'location', 'publicEndpoint_location' - The geographic information for the endpoint.
--
-- 'demographic', 'publicEndpoint_demographic' - The demographic information for the endpoint, such as the time zone and
-- platform.
--
-- 'address', 'publicEndpoint_address' - The unique identifier for the recipient, such as a device token, email
-- address, or mobile phone number.
--
-- 'effectiveDate', 'publicEndpoint_effectiveDate' - The date and time, in ISO 8601 format, when the endpoint was last
-- updated.
--
-- 'user', 'publicEndpoint_user' - One or more custom user attributes that your app reports to Amazon
-- Pinpoint for the user who\'s associated with the endpoint.
--
-- 'attributes', 'publicEndpoint_attributes' - One or more custom attributes that describe the endpoint by associating
-- a name with an array of values. You can use these attributes as filter
-- criteria when you create segments.
--
-- 'endpointStatus', 'publicEndpoint_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', 'publicEndpoint_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', 'publicEndpoint_channelType' - The channel that\'s used when sending messages or push notifications to
-- the endpoint.
newPublicEndpoint ::
  PublicEndpoint
newPublicEndpoint :: PublicEndpoint
newPublicEndpoint =
  PublicEndpoint' :: 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
-> PublicEndpoint
PublicEndpoint'
    { $sel:requestId:PublicEndpoint' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metrics:PublicEndpoint' :: Maybe (HashMap Text Double)
metrics = Maybe (HashMap Text Double)
forall a. Maybe a
Prelude.Nothing,
      $sel:location:PublicEndpoint' :: Maybe EndpointLocation
location = Maybe EndpointLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:demographic:PublicEndpoint' :: Maybe EndpointDemographic
demographic = Maybe EndpointDemographic
forall a. Maybe a
Prelude.Nothing,
      $sel:address:PublicEndpoint' :: Maybe Text
address = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:effectiveDate:PublicEndpoint' :: Maybe Text
effectiveDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:user:PublicEndpoint' :: Maybe EndpointUser
user = Maybe EndpointUser
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:PublicEndpoint' :: Maybe (HashMap Text [Text])
attributes = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointStatus:PublicEndpoint' :: Maybe Text
endpointStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:optOut:PublicEndpoint' :: Maybe Text
optOut = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelType:PublicEndpoint' :: Maybe ChannelType
channelType = Maybe ChannelType
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier that\'s generated each time the endpoint is updated.
publicEndpoint_requestId :: Lens.Lens' PublicEndpoint (Prelude.Maybe Prelude.Text)
publicEndpoint_requestId :: (Maybe Text -> f (Maybe Text))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_requestId = (PublicEndpoint -> Maybe Text)
-> (PublicEndpoint -> Maybe Text -> PublicEndpoint)
-> Lens PublicEndpoint PublicEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicEndpoint' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PublicEndpoint' :: PublicEndpoint -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe Text
a -> PublicEndpoint
s {$sel:requestId:PublicEndpoint' :: Maybe Text
requestId = Maybe Text
a} :: PublicEndpoint)

-- | One or more custom metrics that your app reports to Amazon Pinpoint for
-- the endpoint.
publicEndpoint_metrics :: Lens.Lens' PublicEndpoint (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
publicEndpoint_metrics :: (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_metrics = (PublicEndpoint -> Maybe (HashMap Text Double))
-> (PublicEndpoint
    -> Maybe (HashMap Text Double) -> PublicEndpoint)
-> Lens
     PublicEndpoint
     PublicEndpoint
     (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 (\PublicEndpoint' {Maybe (HashMap Text Double)
metrics :: Maybe (HashMap Text Double)
$sel:metrics:PublicEndpoint' :: PublicEndpoint -> Maybe (HashMap Text Double)
metrics} -> Maybe (HashMap Text Double)
metrics) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe (HashMap Text Double)
a -> PublicEndpoint
s {$sel:metrics:PublicEndpoint' :: Maybe (HashMap Text Double)
metrics = Maybe (HashMap Text Double)
a} :: PublicEndpoint) ((Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
 -> PublicEndpoint -> f PublicEndpoint)
-> ((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)))
-> PublicEndpoint
-> f PublicEndpoint
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.
publicEndpoint_location :: Lens.Lens' PublicEndpoint (Prelude.Maybe EndpointLocation)
publicEndpoint_location :: (Maybe EndpointLocation -> f (Maybe EndpointLocation))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_location = (PublicEndpoint -> Maybe EndpointLocation)
-> (PublicEndpoint -> Maybe EndpointLocation -> PublicEndpoint)
-> Lens
     PublicEndpoint
     PublicEndpoint
     (Maybe EndpointLocation)
     (Maybe EndpointLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicEndpoint' {Maybe EndpointLocation
location :: Maybe EndpointLocation
$sel:location:PublicEndpoint' :: PublicEndpoint -> Maybe EndpointLocation
location} -> Maybe EndpointLocation
location) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe EndpointLocation
a -> PublicEndpoint
s {$sel:location:PublicEndpoint' :: Maybe EndpointLocation
location = Maybe EndpointLocation
a} :: PublicEndpoint)

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

-- | The unique identifier for the recipient, such as a device token, email
-- address, or mobile phone number.
publicEndpoint_address :: Lens.Lens' PublicEndpoint (Prelude.Maybe Prelude.Text)
publicEndpoint_address :: (Maybe Text -> f (Maybe Text))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_address = (PublicEndpoint -> Maybe Text)
-> (PublicEndpoint -> Maybe Text -> PublicEndpoint)
-> Lens PublicEndpoint PublicEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicEndpoint' {Maybe Text
address :: Maybe Text
$sel:address:PublicEndpoint' :: PublicEndpoint -> Maybe Text
address} -> Maybe Text
address) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe Text
a -> PublicEndpoint
s {$sel:address:PublicEndpoint' :: Maybe Text
address = Maybe Text
a} :: PublicEndpoint)

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

-- | One or more custom user attributes that your app reports to Amazon
-- Pinpoint for the user who\'s associated with the endpoint.
publicEndpoint_user :: Lens.Lens' PublicEndpoint (Prelude.Maybe EndpointUser)
publicEndpoint_user :: (Maybe EndpointUser -> f (Maybe EndpointUser))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_user = (PublicEndpoint -> Maybe EndpointUser)
-> (PublicEndpoint -> Maybe EndpointUser -> PublicEndpoint)
-> Lens
     PublicEndpoint
     PublicEndpoint
     (Maybe EndpointUser)
     (Maybe EndpointUser)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicEndpoint' {Maybe EndpointUser
user :: Maybe EndpointUser
$sel:user:PublicEndpoint' :: PublicEndpoint -> Maybe EndpointUser
user} -> Maybe EndpointUser
user) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe EndpointUser
a -> PublicEndpoint
s {$sel:user:PublicEndpoint' :: Maybe EndpointUser
user = Maybe EndpointUser
a} :: PublicEndpoint)

-- | One or more custom attributes that describe the endpoint by associating
-- a name with an array of values. You can use these attributes as filter
-- criteria when you create segments.
publicEndpoint_attributes :: Lens.Lens' PublicEndpoint (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
publicEndpoint_attributes :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_attributes = (PublicEndpoint -> Maybe (HashMap Text [Text]))
-> (PublicEndpoint
    -> Maybe (HashMap Text [Text]) -> PublicEndpoint)
-> Lens
     PublicEndpoint
     PublicEndpoint
     (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 (\PublicEndpoint' {Maybe (HashMap Text [Text])
attributes :: Maybe (HashMap Text [Text])
$sel:attributes:PublicEndpoint' :: PublicEndpoint -> Maybe (HashMap Text [Text])
attributes} -> Maybe (HashMap Text [Text])
attributes) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe (HashMap Text [Text])
a -> PublicEndpoint
s {$sel:attributes:PublicEndpoint' :: Maybe (HashMap Text [Text])
attributes = Maybe (HashMap Text [Text])
a} :: PublicEndpoint) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> PublicEndpoint -> f PublicEndpoint)
-> ((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])))
-> PublicEndpoint
-> f PublicEndpoint
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.
publicEndpoint_endpointStatus :: Lens.Lens' PublicEndpoint (Prelude.Maybe Prelude.Text)
publicEndpoint_endpointStatus :: (Maybe Text -> f (Maybe Text))
-> PublicEndpoint -> f PublicEndpoint
publicEndpoint_endpointStatus = (PublicEndpoint -> Maybe Text)
-> (PublicEndpoint -> Maybe Text -> PublicEndpoint)
-> Lens PublicEndpoint PublicEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicEndpoint' {Maybe Text
endpointStatus :: Maybe Text
$sel:endpointStatus:PublicEndpoint' :: PublicEndpoint -> Maybe Text
endpointStatus} -> Maybe Text
endpointStatus) (\s :: PublicEndpoint
s@PublicEndpoint' {} Maybe Text
a -> PublicEndpoint
s {$sel:endpointStatus:PublicEndpoint' :: Maybe Text
endpointStatus = Maybe Text
a} :: PublicEndpoint)

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

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

instance Prelude.Hashable PublicEndpoint

instance Prelude.NFData PublicEndpoint

instance Core.ToJSON PublicEndpoint where
  toJSON :: PublicEndpoint -> Value
toJSON PublicEndpoint' {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:PublicEndpoint' :: PublicEndpoint -> Maybe ChannelType
$sel:optOut:PublicEndpoint' :: PublicEndpoint -> Maybe Text
$sel:endpointStatus:PublicEndpoint' :: PublicEndpoint -> Maybe Text
$sel:attributes:PublicEndpoint' :: PublicEndpoint -> Maybe (HashMap Text [Text])
$sel:user:PublicEndpoint' :: PublicEndpoint -> Maybe EndpointUser
$sel:effectiveDate:PublicEndpoint' :: PublicEndpoint -> Maybe Text
$sel:address:PublicEndpoint' :: PublicEndpoint -> Maybe Text
$sel:demographic:PublicEndpoint' :: PublicEndpoint -> Maybe EndpointDemographic
$sel:location:PublicEndpoint' :: PublicEndpoint -> Maybe EndpointLocation
$sel:metrics:PublicEndpoint' :: PublicEndpoint -> Maybe (HashMap Text Double)
$sel:requestId:PublicEndpoint' :: PublicEndpoint -> 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
          ]
      )