{-# 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.ConnectionStatusEventConfiguration
-- 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.ConnectionStatusEventConfiguration 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.LoRaWANConnectionStatusEventNotificationConfigurations
import qualified Amazonka.Prelude as Prelude

-- | Connection status event configuration object for enabling or disabling
-- topic.
--
-- /See:/ 'newConnectionStatusEventConfiguration' smart constructor.
data ConnectionStatusEventConfiguration = ConnectionStatusEventConfiguration'
  { -- | Connection status event configuration object for enabling or disabling
    -- LoRaWAN related event topics.
    ConnectionStatusEventConfiguration
-> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN :: Prelude.Maybe LoRaWANConnectionStatusEventNotificationConfigurations,
    -- | Denotes whether the wireless gateway ID connection status event topic is
    -- enabled or disabled.
    ConnectionStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic :: Prelude.Maybe EventNotificationTopicStatus
  }
  deriving (ConnectionStatusEventConfiguration
-> ConnectionStatusEventConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionStatusEventConfiguration
-> ConnectionStatusEventConfiguration -> Bool
$c/= :: ConnectionStatusEventConfiguration
-> ConnectionStatusEventConfiguration -> Bool
== :: ConnectionStatusEventConfiguration
-> ConnectionStatusEventConfiguration -> Bool
$c== :: ConnectionStatusEventConfiguration
-> ConnectionStatusEventConfiguration -> Bool
Prelude.Eq, ReadPrec [ConnectionStatusEventConfiguration]
ReadPrec ConnectionStatusEventConfiguration
Int -> ReadS ConnectionStatusEventConfiguration
ReadS [ConnectionStatusEventConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionStatusEventConfiguration]
$creadListPrec :: ReadPrec [ConnectionStatusEventConfiguration]
readPrec :: ReadPrec ConnectionStatusEventConfiguration
$creadPrec :: ReadPrec ConnectionStatusEventConfiguration
readList :: ReadS [ConnectionStatusEventConfiguration]
$creadList :: ReadS [ConnectionStatusEventConfiguration]
readsPrec :: Int -> ReadS ConnectionStatusEventConfiguration
$creadsPrec :: Int -> ReadS ConnectionStatusEventConfiguration
Prelude.Read, Int -> ConnectionStatusEventConfiguration -> ShowS
[ConnectionStatusEventConfiguration] -> ShowS
ConnectionStatusEventConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionStatusEventConfiguration] -> ShowS
$cshowList :: [ConnectionStatusEventConfiguration] -> ShowS
show :: ConnectionStatusEventConfiguration -> String
$cshow :: ConnectionStatusEventConfiguration -> String
showsPrec :: Int -> ConnectionStatusEventConfiguration -> ShowS
$cshowsPrec :: Int -> ConnectionStatusEventConfiguration -> ShowS
Prelude.Show, forall x.
Rep ConnectionStatusEventConfiguration x
-> ConnectionStatusEventConfiguration
forall x.
ConnectionStatusEventConfiguration
-> Rep ConnectionStatusEventConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionStatusEventConfiguration x
-> ConnectionStatusEventConfiguration
$cfrom :: forall x.
ConnectionStatusEventConfiguration
-> Rep ConnectionStatusEventConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionStatusEventConfiguration' 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:
--
-- 'loRaWAN', 'connectionStatusEventConfiguration_loRaWAN' - Connection status event configuration object for enabling or disabling
-- LoRaWAN related event topics.
--
-- 'wirelessGatewayIdEventTopic', 'connectionStatusEventConfiguration_wirelessGatewayIdEventTopic' - Denotes whether the wireless gateway ID connection status event topic is
-- enabled or disabled.
newConnectionStatusEventConfiguration ::
  ConnectionStatusEventConfiguration
newConnectionStatusEventConfiguration :: ConnectionStatusEventConfiguration
newConnectionStatusEventConfiguration =
  ConnectionStatusEventConfiguration'
    { $sel:loRaWAN:ConnectionStatusEventConfiguration' :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN =
        forall a. Maybe a
Prelude.Nothing,
      $sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Connection status event configuration object for enabling or disabling
-- LoRaWAN related event topics.
connectionStatusEventConfiguration_loRaWAN :: Lens.Lens' ConnectionStatusEventConfiguration (Prelude.Maybe LoRaWANConnectionStatusEventNotificationConfigurations)
connectionStatusEventConfiguration_loRaWAN :: Lens'
  ConnectionStatusEventConfiguration
  (Maybe LoRaWANConnectionStatusEventNotificationConfigurations)
connectionStatusEventConfiguration_loRaWAN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionStatusEventConfiguration' {Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
$sel:loRaWAN:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN} -> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN) (\s :: ConnectionStatusEventConfiguration
s@ConnectionStatusEventConfiguration' {} Maybe LoRaWANConnectionStatusEventNotificationConfigurations
a -> ConnectionStatusEventConfiguration
s {$sel:loRaWAN:ConnectionStatusEventConfiguration' :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN = Maybe LoRaWANConnectionStatusEventNotificationConfigurations
a} :: ConnectionStatusEventConfiguration)

-- | Denotes whether the wireless gateway ID connection status event topic is
-- enabled or disabled.
connectionStatusEventConfiguration_wirelessGatewayIdEventTopic :: Lens.Lens' ConnectionStatusEventConfiguration (Prelude.Maybe EventNotificationTopicStatus)
connectionStatusEventConfiguration_wirelessGatewayIdEventTopic :: Lens'
  ConnectionStatusEventConfiguration
  (Maybe EventNotificationTopicStatus)
connectionStatusEventConfiguration_wirelessGatewayIdEventTopic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionStatusEventConfiguration' {Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic :: Maybe EventNotificationTopicStatus
$sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic} -> Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic) (\s :: ConnectionStatusEventConfiguration
s@ConnectionStatusEventConfiguration' {} Maybe EventNotificationTopicStatus
a -> ConnectionStatusEventConfiguration
s {$sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic = Maybe EventNotificationTopicStatus
a} :: ConnectionStatusEventConfiguration)

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

instance
  Prelude.Hashable
    ConnectionStatusEventConfiguration
  where
  hashWithSalt :: Int -> ConnectionStatusEventConfiguration -> Int
hashWithSalt
    Int
_salt
    ConnectionStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe LoRaWANConnectionStatusEventNotificationConfigurations
wirelessGatewayIdEventTopic :: Maybe EventNotificationTopicStatus
loRaWAN :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
$sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:loRaWAN:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic

instance
  Prelude.NFData
    ConnectionStatusEventConfiguration
  where
  rnf :: ConnectionStatusEventConfiguration -> ()
rnf ConnectionStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe LoRaWANConnectionStatusEventNotificationConfigurations
wirelessGatewayIdEventTopic :: Maybe EventNotificationTopicStatus
loRaWAN :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
$sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:loRaWAN:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventNotificationTopicStatus
wirelessGatewayIdEventTopic

instance
  Data.ToJSON
    ConnectionStatusEventConfiguration
  where
  toJSON :: ConnectionStatusEventConfiguration -> Value
toJSON ConnectionStatusEventConfiguration' {Maybe EventNotificationTopicStatus
Maybe LoRaWANConnectionStatusEventNotificationConfigurations
wirelessGatewayIdEventTopic :: Maybe EventNotificationTopicStatus
loRaWAN :: Maybe LoRaWANConnectionStatusEventNotificationConfigurations
$sel:wirelessGatewayIdEventTopic:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe EventNotificationTopicStatus
$sel:loRaWAN:ConnectionStatusEventConfiguration' :: ConnectionStatusEventConfiguration
-> Maybe LoRaWANConnectionStatusEventNotificationConfigurations
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LoRaWAN" 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 LoRaWANConnectionStatusEventNotificationConfigurations
loRaWAN,
            (Key
"WirelessGatewayIdEventTopic" 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
wirelessGatewayIdEventTopic
          ]
      )