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

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

-- |
-- Create a value of 'ProximityEventConfiguration' 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', 'proximityEventConfiguration_sidewalk' - Proximity event configuration object for enabling or disabling Sidewalk
-- related event topics.
--
-- 'wirelessDeviceIdEventTopic', 'proximityEventConfiguration_wirelessDeviceIdEventTopic' - Denotes whether the wireless device ID proximity event topic is enabled
-- or disabled.
newProximityEventConfiguration ::
  ProximityEventConfiguration
newProximityEventConfiguration :: ProximityEventConfiguration
newProximityEventConfiguration =
  ProximityEventConfiguration'
    { $sel:sidewalk:ProximityEventConfiguration' :: Maybe SidewalkEventNotificationConfigurations
sidewalk =
        forall a. Maybe a
Prelude.Nothing,
      $sel:wirelessDeviceIdEventTopic:ProximityEventConfiguration' :: Maybe EventNotificationTopicStatus
wirelessDeviceIdEventTopic = forall a. Maybe a
Prelude.Nothing
    }

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

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

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