{-# 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.SidewalkResourceTypeEventConfiguration
-- 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.SidewalkResourceTypeEventConfiguration 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 qualified Amazonka.Prelude as Prelude

-- | Sidewalk resource type event configuration object for enabling or
-- disabling topic.
--
-- /See:/ 'newSidewalkResourceTypeEventConfiguration' smart constructor.
data SidewalkResourceTypeEventConfiguration = SidewalkResourceTypeEventConfiguration'
  { -- | Denotes whether the wireless device join event topic is enabled or
    -- disabled.
    SidewalkResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Prelude.Maybe EventNotificationTopicStatus
  }
  deriving (SidewalkResourceTypeEventConfiguration
-> SidewalkResourceTypeEventConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SidewalkResourceTypeEventConfiguration
-> SidewalkResourceTypeEventConfiguration -> Bool
$c/= :: SidewalkResourceTypeEventConfiguration
-> SidewalkResourceTypeEventConfiguration -> Bool
== :: SidewalkResourceTypeEventConfiguration
-> SidewalkResourceTypeEventConfiguration -> Bool
$c== :: SidewalkResourceTypeEventConfiguration
-> SidewalkResourceTypeEventConfiguration -> Bool
Prelude.Eq, ReadPrec [SidewalkResourceTypeEventConfiguration]
ReadPrec SidewalkResourceTypeEventConfiguration
Int -> ReadS SidewalkResourceTypeEventConfiguration
ReadS [SidewalkResourceTypeEventConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SidewalkResourceTypeEventConfiguration]
$creadListPrec :: ReadPrec [SidewalkResourceTypeEventConfiguration]
readPrec :: ReadPrec SidewalkResourceTypeEventConfiguration
$creadPrec :: ReadPrec SidewalkResourceTypeEventConfiguration
readList :: ReadS [SidewalkResourceTypeEventConfiguration]
$creadList :: ReadS [SidewalkResourceTypeEventConfiguration]
readsPrec :: Int -> ReadS SidewalkResourceTypeEventConfiguration
$creadsPrec :: Int -> ReadS SidewalkResourceTypeEventConfiguration
Prelude.Read, Int -> SidewalkResourceTypeEventConfiguration -> ShowS
[SidewalkResourceTypeEventConfiguration] -> ShowS
SidewalkResourceTypeEventConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SidewalkResourceTypeEventConfiguration] -> ShowS
$cshowList :: [SidewalkResourceTypeEventConfiguration] -> ShowS
show :: SidewalkResourceTypeEventConfiguration -> String
$cshow :: SidewalkResourceTypeEventConfiguration -> String
showsPrec :: Int -> SidewalkResourceTypeEventConfiguration -> ShowS
$cshowsPrec :: Int -> SidewalkResourceTypeEventConfiguration -> ShowS
Prelude.Show, forall x.
Rep SidewalkResourceTypeEventConfiguration x
-> SidewalkResourceTypeEventConfiguration
forall x.
SidewalkResourceTypeEventConfiguration
-> Rep SidewalkResourceTypeEventConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SidewalkResourceTypeEventConfiguration x
-> SidewalkResourceTypeEventConfiguration
$cfrom :: forall x.
SidewalkResourceTypeEventConfiguration
-> Rep SidewalkResourceTypeEventConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SidewalkResourceTypeEventConfiguration' 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:
--
-- 'wirelessDeviceEventTopic', 'sidewalkResourceTypeEventConfiguration_wirelessDeviceEventTopic' - Denotes whether the wireless device join event topic is enabled or
-- disabled.
newSidewalkResourceTypeEventConfiguration ::
  SidewalkResourceTypeEventConfiguration
newSidewalkResourceTypeEventConfiguration :: SidewalkResourceTypeEventConfiguration
newSidewalkResourceTypeEventConfiguration =
  SidewalkResourceTypeEventConfiguration'
    { $sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Denotes whether the wireless device join event topic is enabled or
-- disabled.
sidewalkResourceTypeEventConfiguration_wirelessDeviceEventTopic :: Lens.Lens' SidewalkResourceTypeEventConfiguration (Prelude.Maybe EventNotificationTopicStatus)
sidewalkResourceTypeEventConfiguration_wirelessDeviceEventTopic :: Lens'
  SidewalkResourceTypeEventConfiguration
  (Maybe EventNotificationTopicStatus)
sidewalkResourceTypeEventConfiguration_wirelessDeviceEventTopic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: SidewalkResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic} -> Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic) (\s :: SidewalkResourceTypeEventConfiguration
s@SidewalkResourceTypeEventConfiguration' {} Maybe EventNotificationTopicStatus
a -> SidewalkResourceTypeEventConfiguration
s {$sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic = Maybe EventNotificationTopicStatus
a} :: SidewalkResourceTypeEventConfiguration)

instance
  Data.FromJSON
    SidewalkResourceTypeEventConfiguration
  where
  parseJSON :: Value -> Parser SidewalkResourceTypeEventConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SidewalkResourceTypeEventConfiguration"
      ( \Object
x ->
          Maybe EventNotificationTopicStatus
-> SidewalkResourceTypeEventConfiguration
SidewalkResourceTypeEventConfiguration'
            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
"WirelessDeviceEventTopic")
      )

instance
  Prelude.Hashable
    SidewalkResourceTypeEventConfiguration
  where
  hashWithSalt :: Int -> SidewalkResourceTypeEventConfiguration -> Int
hashWithSalt
    Int
_salt
    SidewalkResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: SidewalkResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic

instance
  Prelude.NFData
    SidewalkResourceTypeEventConfiguration
  where
  rnf :: SidewalkResourceTypeEventConfiguration -> ()
rnf SidewalkResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: SidewalkResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic

instance
  Data.ToJSON
    SidewalkResourceTypeEventConfiguration
  where
  toJSON :: SidewalkResourceTypeEventConfiguration -> Value
toJSON SidewalkResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:SidewalkResourceTypeEventConfiguration' :: SidewalkResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"WirelessDeviceEventTopic" 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
wirelessDeviceEventTopic
          ]
      )