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

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

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

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

instance
  Data.FromJSON
    LoRaWANJoinResourceTypeEventConfiguration
  where
  parseJSON :: Value -> Parser LoRaWANJoinResourceTypeEventConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LoRaWANJoinResourceTypeEventConfiguration"
      ( \Object
x ->
          Maybe EventNotificationTopicStatus
-> LoRaWANJoinResourceTypeEventConfiguration
LoRaWANJoinResourceTypeEventConfiguration'
            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
    LoRaWANJoinResourceTypeEventConfiguration
  where
  hashWithSalt :: Int -> LoRaWANJoinResourceTypeEventConfiguration -> Int
hashWithSalt
    Int
_salt
    LoRaWANJoinResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:LoRaWANJoinResourceTypeEventConfiguration' :: LoRaWANJoinResourceTypeEventConfiguration
-> Maybe EventNotificationTopicStatus
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic

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

instance
  Data.ToJSON
    LoRaWANJoinResourceTypeEventConfiguration
  where
  toJSON :: LoRaWANJoinResourceTypeEventConfiguration -> Value
toJSON LoRaWANJoinResourceTypeEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessDeviceEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessDeviceEventTopic:LoRaWANJoinResourceTypeEventConfiguration' :: LoRaWANJoinResourceTypeEventConfiguration
-> 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
          ]
      )