{-# 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.IoTWireless.Types.MessageDeliveryStatusEventConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTWireless.Types.MessageDeliveryStatusEventConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types.EventNotificationTopicStatus
import Amazonka.IoTWireless.Types.SidewalkEventNotificationConfigurations
import qualified Amazonka.Prelude as Prelude

-- | Message delivery status event configuration object for enabling and
-- disabling relevant topics.
--
-- /See:/ 'newMessageDeliveryStatusEventConfiguration' smart constructor.
data MessageDeliveryStatusEventConfiguration = MessageDeliveryStatusEventConfiguration'
  { MessageDeliveryStatusEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
sidewalk :: Prelude.Maybe SidewalkEventNotificationConfigurations,
    -- | Denotes whether the wireless device ID message delivery status event
    -- topic is enabled or disabled.
    MessageDeliveryStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic :: Prelude.Maybe EventNotificationTopicStatus
  }
  deriving (MessageDeliveryStatusEventConfiguration
-> MessageDeliveryStatusEventConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageDeliveryStatusEventConfiguration
-> MessageDeliveryStatusEventConfiguration -> Bool
$c/= :: MessageDeliveryStatusEventConfiguration
-> MessageDeliveryStatusEventConfiguration -> Bool
== :: MessageDeliveryStatusEventConfiguration
-> MessageDeliveryStatusEventConfiguration -> Bool
$c== :: MessageDeliveryStatusEventConfiguration
-> MessageDeliveryStatusEventConfiguration -> Bool
Prelude.Eq, ReadPrec [MessageDeliveryStatusEventConfiguration]
ReadPrec MessageDeliveryStatusEventConfiguration
Int -> ReadS MessageDeliveryStatusEventConfiguration
ReadS [MessageDeliveryStatusEventConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessageDeliveryStatusEventConfiguration]
$creadListPrec :: ReadPrec [MessageDeliveryStatusEventConfiguration]
readPrec :: ReadPrec MessageDeliveryStatusEventConfiguration
$creadPrec :: ReadPrec MessageDeliveryStatusEventConfiguration
readList :: ReadS [MessageDeliveryStatusEventConfiguration]
$creadList :: ReadS [MessageDeliveryStatusEventConfiguration]
readsPrec :: Int -> ReadS MessageDeliveryStatusEventConfiguration
$creadsPrec :: Int -> ReadS MessageDeliveryStatusEventConfiguration
Prelude.Read, Int -> MessageDeliveryStatusEventConfiguration -> ShowS
[MessageDeliveryStatusEventConfiguration] -> ShowS
MessageDeliveryStatusEventConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageDeliveryStatusEventConfiguration] -> ShowS
$cshowList :: [MessageDeliveryStatusEventConfiguration] -> ShowS
show :: MessageDeliveryStatusEventConfiguration -> String
$cshow :: MessageDeliveryStatusEventConfiguration -> String
showsPrec :: Int -> MessageDeliveryStatusEventConfiguration -> ShowS
$cshowsPrec :: Int -> MessageDeliveryStatusEventConfiguration -> ShowS
Prelude.Show, forall x.
Rep MessageDeliveryStatusEventConfiguration x
-> MessageDeliveryStatusEventConfiguration
forall x.
MessageDeliveryStatusEventConfiguration
-> Rep MessageDeliveryStatusEventConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MessageDeliveryStatusEventConfiguration x
-> MessageDeliveryStatusEventConfiguration
$cfrom :: forall x.
MessageDeliveryStatusEventConfiguration
-> Rep MessageDeliveryStatusEventConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MessageDeliveryStatusEventConfiguration' 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:
--
-- 'sidewalk', 'messageDeliveryStatusEventConfiguration_sidewalk' - Undocumented member.
--
-- 'wirelessDeviceIdEventTopic', 'messageDeliveryStatusEventConfiguration_wirelessDeviceIdEventTopic' - Denotes whether the wireless device ID message delivery status event
-- topic is enabled or disabled.
newMessageDeliveryStatusEventConfiguration ::
  MessageDeliveryStatusEventConfiguration
newMessageDeliveryStatusEventConfiguration :: MessageDeliveryStatusEventConfiguration
newMessageDeliveryStatusEventConfiguration =
  MessageDeliveryStatusEventConfiguration'
    { $sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: Maybe SidewalkEventNotificationConfigurations
sidewalk =
        forall a. Maybe a
Prelude.Nothing,
      $sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
messageDeliveryStatusEventConfiguration_sidewalk :: Lens.Lens' MessageDeliveryStatusEventConfiguration (Prelude.Maybe SidewalkEventNotificationConfigurations)
messageDeliveryStatusEventConfiguration_sidewalk :: Lens'
  MessageDeliveryStatusEventConfiguration
  (Maybe SidewalkEventNotificationConfigurations)
messageDeliveryStatusEventConfiguration_sidewalk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageDeliveryStatusEventConfiguration' {Maybe SidewalkEventNotificationConfigurations
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
sidewalk} -> Maybe SidewalkEventNotificationConfigurations
sidewalk) (\s :: MessageDeliveryStatusEventConfiguration
s@MessageDeliveryStatusEventConfiguration' {} Maybe SidewalkEventNotificationConfigurations
a -> MessageDeliveryStatusEventConfiguration
s {$sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: Maybe SidewalkEventNotificationConfigurations
sidewalk = Maybe SidewalkEventNotificationConfigurations
a} :: MessageDeliveryStatusEventConfiguration)

-- | Denotes whether the wireless device ID message delivery status event
-- topic is enabled or disabled.
messageDeliveryStatusEventConfiguration_wirelessDeviceIdEventTopic :: Lens.Lens' MessageDeliveryStatusEventConfiguration (Prelude.Maybe EventNotificationTopicStatus)
messageDeliveryStatusEventConfiguration_wirelessDeviceIdEventTopic :: Lens'
  MessageDeliveryStatusEventConfiguration
  (Maybe EventNotificationTopicStatus)
messageDeliveryStatusEventConfiguration_wirelessDeviceIdEventTopic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageDeliveryStatusEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic} -> Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic) (\s :: MessageDeliveryStatusEventConfiguration
s@MessageDeliveryStatusEventConfiguration' {} Maybe EventNotificationTopicStatus
a -> MessageDeliveryStatusEventConfiguration
s {$sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic = Maybe EventNotificationTopicStatus
a} :: MessageDeliveryStatusEventConfiguration)

instance
  Data.FromJSON
    MessageDeliveryStatusEventConfiguration
  where
  parseJSON :: Value -> Parser MessageDeliveryStatusEventConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MessageDeliveryStatusEventConfiguration"
      ( \Object
x ->
          Maybe SidewalkEventNotificationConfigurations
-> Maybe EventNotificationTopicStatus
-> MessageDeliveryStatusEventConfiguration
MessageDeliveryStatusEventConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Sidewalk")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WirelessDeviceIdEventTopic")
      )

instance
  Prelude.Hashable
    MessageDeliveryStatusEventConfiguration
  where
  hashWithSalt :: Int -> MessageDeliveryStatusEventConfiguration -> Int
hashWithSalt
    Int
_salt
    MessageDeliveryStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SidewalkEventNotificationConfigurations
sidewalk
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic

instance
  Prelude.NFData
    MessageDeliveryStatusEventConfiguration
  where
  rnf :: MessageDeliveryStatusEventConfiguration -> ()
rnf MessageDeliveryStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SidewalkEventNotificationConfigurations
sidewalk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic

instance
  Data.ToJSON
    MessageDeliveryStatusEventConfiguration
  where
  toJSON :: MessageDeliveryStatusEventConfiguration -> Value
toJSON MessageDeliveryStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:MessageDeliveryStatusEventConfiguration' :: MessageDeliveryStatusEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Sidewalk" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SidewalkEventNotificationConfigurations
sidewalk,
            (Key
"WirelessDeviceIdEventTopic" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic
          ]
      )