{-# 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.DeviceRegistrationStateEventConfiguration
-- 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.DeviceRegistrationStateEventConfiguration 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

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

-- |
-- Create a value of 'DeviceRegistrationStateEventConfiguration' 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', 'deviceRegistrationStateEventConfiguration_sidewalk' - Device registration state event configuration object for enabling or
-- disabling Sidewalk related event topics.
--
-- 'wirelessDeviceIdEventTopic', 'deviceRegistrationStateEventConfiguration_wirelessDeviceIdEventTopic' - Denotes whether the wireless device ID device registration state event
-- topic is enabled or disabled.
newDeviceRegistrationStateEventConfiguration ::
  DeviceRegistrationStateEventConfiguration
newDeviceRegistrationStateEventConfiguration :: DeviceRegistrationStateEventConfiguration
newDeviceRegistrationStateEventConfiguration =
  DeviceRegistrationStateEventConfiguration'
    { $sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: Maybe SidewalkEventNotificationConfigurations
sidewalk =
        forall a. Maybe a
Prelude.Nothing,
      $sel:wirelessDeviceIdEventTopic:DeviceRegistrationStateEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Device registration state event configuration object for enabling or
-- disabling Sidewalk related event topics.
deviceRegistrationStateEventConfiguration_sidewalk :: Lens.Lens' DeviceRegistrationStateEventConfiguration (Prelude.Maybe SidewalkEventNotificationConfigurations)
deviceRegistrationStateEventConfiguration_sidewalk :: Lens'
  DeviceRegistrationStateEventConfiguration
  (Maybe SidewalkEventNotificationConfigurations)
deviceRegistrationStateEventConfiguration_sidewalk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceRegistrationStateEventConfiguration' {Maybe SidewalkEventNotificationConfigurations
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> Maybe SidewalkEventNotificationConfigurations
sidewalk} -> Maybe SidewalkEventNotificationConfigurations
sidewalk) (\s :: DeviceRegistrationStateEventConfiguration
s@DeviceRegistrationStateEventConfiguration' {} Maybe SidewalkEventNotificationConfigurations
a -> DeviceRegistrationStateEventConfiguration
s {$sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: Maybe SidewalkEventNotificationConfigurations
sidewalk = Maybe SidewalkEventNotificationConfigurations
a} :: DeviceRegistrationStateEventConfiguration)

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

instance
  Data.FromJSON
    DeviceRegistrationStateEventConfiguration
  where
  parseJSON :: Value -> Parser DeviceRegistrationStateEventConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceRegistrationStateEventConfiguration"
      ( \Object
x ->
          Maybe SidewalkEventNotificationConfigurations
-> Maybe EventNotificationTopicStatus
-> DeviceRegistrationStateEventConfiguration
DeviceRegistrationStateEventConfiguration'
            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
    DeviceRegistrationStateEventConfiguration
  where
  hashWithSalt :: Int -> DeviceRegistrationStateEventConfiguration -> Int
hashWithSalt
    Int
_salt
    DeviceRegistrationStateEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> 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
    DeviceRegistrationStateEventConfiguration
  where
  rnf :: DeviceRegistrationStateEventConfiguration -> ()
rnf DeviceRegistrationStateEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> 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
    DeviceRegistrationStateEventConfiguration
  where
  toJSON :: DeviceRegistrationStateEventConfiguration -> Value
toJSON DeviceRegistrationStateEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe SidewalkEventNotificationConfigurations
wirelessDeviceIdEventTopic :: Maybe EventNotificationTopicStatus
sidewalk :: Maybe SidewalkEventNotificationConfigurations
$sel:wirelessDeviceIdEventTopic:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:sidewalk:DeviceRegistrationStateEventConfiguration' :: DeviceRegistrationStateEventConfiguration
-> 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
          ]
      )