{-# 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.WirelessMetadata
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTWireless.Types.WirelessMetadata where

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.LoRaWANSendDataToDevice
import Amazonka.IoTWireless.Types.SidewalkSendDataToDevice
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | WirelessMetadata object.
--
-- /See:/ 'newWirelessMetadata' smart constructor.
data WirelessMetadata = WirelessMetadata'
  { -- | The Sidewalk account credentials.
    WirelessMetadata -> Maybe SidewalkSendDataToDevice
sidewalk :: Prelude.Maybe SidewalkSendDataToDevice,
    -- | LoRaWAN device info.
    WirelessMetadata -> Maybe LoRaWANSendDataToDevice
loRaWAN :: Prelude.Maybe LoRaWANSendDataToDevice
  }
  deriving (WirelessMetadata -> WirelessMetadata -> Bool
(WirelessMetadata -> WirelessMetadata -> Bool)
-> (WirelessMetadata -> WirelessMetadata -> Bool)
-> Eq WirelessMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WirelessMetadata -> WirelessMetadata -> Bool
$c/= :: WirelessMetadata -> WirelessMetadata -> Bool
== :: WirelessMetadata -> WirelessMetadata -> Bool
$c== :: WirelessMetadata -> WirelessMetadata -> Bool
Prelude.Eq, ReadPrec [WirelessMetadata]
ReadPrec WirelessMetadata
Int -> ReadS WirelessMetadata
ReadS [WirelessMetadata]
(Int -> ReadS WirelessMetadata)
-> ReadS [WirelessMetadata]
-> ReadPrec WirelessMetadata
-> ReadPrec [WirelessMetadata]
-> Read WirelessMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WirelessMetadata]
$creadListPrec :: ReadPrec [WirelessMetadata]
readPrec :: ReadPrec WirelessMetadata
$creadPrec :: ReadPrec WirelessMetadata
readList :: ReadS [WirelessMetadata]
$creadList :: ReadS [WirelessMetadata]
readsPrec :: Int -> ReadS WirelessMetadata
$creadsPrec :: Int -> ReadS WirelessMetadata
Prelude.Read, Int -> WirelessMetadata -> ShowS
[WirelessMetadata] -> ShowS
WirelessMetadata -> String
(Int -> WirelessMetadata -> ShowS)
-> (WirelessMetadata -> String)
-> ([WirelessMetadata] -> ShowS)
-> Show WirelessMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WirelessMetadata] -> ShowS
$cshowList :: [WirelessMetadata] -> ShowS
show :: WirelessMetadata -> String
$cshow :: WirelessMetadata -> String
showsPrec :: Int -> WirelessMetadata -> ShowS
$cshowsPrec :: Int -> WirelessMetadata -> ShowS
Prelude.Show, (forall x. WirelessMetadata -> Rep WirelessMetadata x)
-> (forall x. Rep WirelessMetadata x -> WirelessMetadata)
-> Generic WirelessMetadata
forall x. Rep WirelessMetadata x -> WirelessMetadata
forall x. WirelessMetadata -> Rep WirelessMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WirelessMetadata x -> WirelessMetadata
$cfrom :: forall x. WirelessMetadata -> Rep WirelessMetadata x
Prelude.Generic)

-- |
-- Create a value of 'WirelessMetadata' 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', 'wirelessMetadata_sidewalk' - The Sidewalk account credentials.
--
-- 'loRaWAN', 'wirelessMetadata_loRaWAN' - LoRaWAN device info.
newWirelessMetadata ::
  WirelessMetadata
newWirelessMetadata :: WirelessMetadata
newWirelessMetadata =
  WirelessMetadata' :: Maybe SidewalkSendDataToDevice
-> Maybe LoRaWANSendDataToDevice -> WirelessMetadata
WirelessMetadata'
    { $sel:sidewalk:WirelessMetadata' :: Maybe SidewalkSendDataToDevice
sidewalk = Maybe SidewalkSendDataToDevice
forall a. Maybe a
Prelude.Nothing,
      $sel:loRaWAN:WirelessMetadata' :: Maybe LoRaWANSendDataToDevice
loRaWAN = Maybe LoRaWANSendDataToDevice
forall a. Maybe a
Prelude.Nothing
    }

-- | The Sidewalk account credentials.
wirelessMetadata_sidewalk :: Lens.Lens' WirelessMetadata (Prelude.Maybe SidewalkSendDataToDevice)
wirelessMetadata_sidewalk :: (Maybe SidewalkSendDataToDevice
 -> f (Maybe SidewalkSendDataToDevice))
-> WirelessMetadata -> f WirelessMetadata
wirelessMetadata_sidewalk = (WirelessMetadata -> Maybe SidewalkSendDataToDevice)
-> (WirelessMetadata
    -> Maybe SidewalkSendDataToDevice -> WirelessMetadata)
-> Lens
     WirelessMetadata
     WirelessMetadata
     (Maybe SidewalkSendDataToDevice)
     (Maybe SidewalkSendDataToDevice)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessMetadata' {Maybe SidewalkSendDataToDevice
sidewalk :: Maybe SidewalkSendDataToDevice
$sel:sidewalk:WirelessMetadata' :: WirelessMetadata -> Maybe SidewalkSendDataToDevice
sidewalk} -> Maybe SidewalkSendDataToDevice
sidewalk) (\s :: WirelessMetadata
s@WirelessMetadata' {} Maybe SidewalkSendDataToDevice
a -> WirelessMetadata
s {$sel:sidewalk:WirelessMetadata' :: Maybe SidewalkSendDataToDevice
sidewalk = Maybe SidewalkSendDataToDevice
a} :: WirelessMetadata)

-- | LoRaWAN device info.
wirelessMetadata_loRaWAN :: Lens.Lens' WirelessMetadata (Prelude.Maybe LoRaWANSendDataToDevice)
wirelessMetadata_loRaWAN :: (Maybe LoRaWANSendDataToDevice
 -> f (Maybe LoRaWANSendDataToDevice))
-> WirelessMetadata -> f WirelessMetadata
wirelessMetadata_loRaWAN = (WirelessMetadata -> Maybe LoRaWANSendDataToDevice)
-> (WirelessMetadata
    -> Maybe LoRaWANSendDataToDevice -> WirelessMetadata)
-> Lens
     WirelessMetadata
     WirelessMetadata
     (Maybe LoRaWANSendDataToDevice)
     (Maybe LoRaWANSendDataToDevice)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessMetadata' {Maybe LoRaWANSendDataToDevice
loRaWAN :: Maybe LoRaWANSendDataToDevice
$sel:loRaWAN:WirelessMetadata' :: WirelessMetadata -> Maybe LoRaWANSendDataToDevice
loRaWAN} -> Maybe LoRaWANSendDataToDevice
loRaWAN) (\s :: WirelessMetadata
s@WirelessMetadata' {} Maybe LoRaWANSendDataToDevice
a -> WirelessMetadata
s {$sel:loRaWAN:WirelessMetadata' :: Maybe LoRaWANSendDataToDevice
loRaWAN = Maybe LoRaWANSendDataToDevice
a} :: WirelessMetadata)

instance Prelude.Hashable WirelessMetadata

instance Prelude.NFData WirelessMetadata

instance Core.ToJSON WirelessMetadata where
  toJSON :: WirelessMetadata -> Value
toJSON WirelessMetadata' {Maybe LoRaWANSendDataToDevice
Maybe SidewalkSendDataToDevice
loRaWAN :: Maybe LoRaWANSendDataToDevice
sidewalk :: Maybe SidewalkSendDataToDevice
$sel:loRaWAN:WirelessMetadata' :: WirelessMetadata -> Maybe LoRaWANSendDataToDevice
$sel:sidewalk:WirelessMetadata' :: WirelessMetadata -> Maybe SidewalkSendDataToDevice
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Sidewalk" Text -> SidewalkSendDataToDevice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SidewalkSendDataToDevice -> Pair)
-> Maybe SidewalkSendDataToDevice -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SidewalkSendDataToDevice
sidewalk,
            (Text
"LoRaWAN" Text -> LoRaWANSendDataToDevice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LoRaWANSendDataToDevice -> Pair)
-> Maybe LoRaWANSendDataToDevice -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoRaWANSendDataToDevice
loRaWAN
          ]
      )