{-# 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.LoRaWANDeviceMetadata
-- 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.LoRaWANDeviceMetadata where

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.LoRaWANGatewayMetadata
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | LoRaWAN device metatdata.
--
-- /See:/ 'newLoRaWANDeviceMetadata' smart constructor.
data LoRaWANDeviceMetadata = LoRaWANDeviceMetadata'
  { -- | The device\'s channel frequency in Hz.
    LoRaWANDeviceMetadata -> Maybe Int
frequency :: Prelude.Maybe Prelude.Int,
    -- | The FPort value.
    LoRaWANDeviceMetadata -> Maybe Int
fPort :: Prelude.Maybe Prelude.Int,
    -- | The DataRate value.
    LoRaWANDeviceMetadata -> Maybe Int
dataRate :: Prelude.Maybe Prelude.Int,
    -- | Information about the gateways accessed by the device.
    LoRaWANDeviceMetadata -> Maybe [LoRaWANGatewayMetadata]
gateways :: Prelude.Maybe [LoRaWANGatewayMetadata],
    -- | The date and time of the metadata.
    LoRaWANDeviceMetadata -> Maybe Text
timestamp :: Prelude.Maybe Prelude.Text,
    -- | The DevEUI value.
    LoRaWANDeviceMetadata -> Maybe Text
devEui :: Prelude.Maybe Prelude.Text
  }
  deriving (LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool
(LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool)
-> (LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool)
-> Eq LoRaWANDeviceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool
$c/= :: LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool
== :: LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool
$c== :: LoRaWANDeviceMetadata -> LoRaWANDeviceMetadata -> Bool
Prelude.Eq, ReadPrec [LoRaWANDeviceMetadata]
ReadPrec LoRaWANDeviceMetadata
Int -> ReadS LoRaWANDeviceMetadata
ReadS [LoRaWANDeviceMetadata]
(Int -> ReadS LoRaWANDeviceMetadata)
-> ReadS [LoRaWANDeviceMetadata]
-> ReadPrec LoRaWANDeviceMetadata
-> ReadPrec [LoRaWANDeviceMetadata]
-> Read LoRaWANDeviceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANDeviceMetadata]
$creadListPrec :: ReadPrec [LoRaWANDeviceMetadata]
readPrec :: ReadPrec LoRaWANDeviceMetadata
$creadPrec :: ReadPrec LoRaWANDeviceMetadata
readList :: ReadS [LoRaWANDeviceMetadata]
$creadList :: ReadS [LoRaWANDeviceMetadata]
readsPrec :: Int -> ReadS LoRaWANDeviceMetadata
$creadsPrec :: Int -> ReadS LoRaWANDeviceMetadata
Prelude.Read, Int -> LoRaWANDeviceMetadata -> ShowS
[LoRaWANDeviceMetadata] -> ShowS
LoRaWANDeviceMetadata -> String
(Int -> LoRaWANDeviceMetadata -> ShowS)
-> (LoRaWANDeviceMetadata -> String)
-> ([LoRaWANDeviceMetadata] -> ShowS)
-> Show LoRaWANDeviceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANDeviceMetadata] -> ShowS
$cshowList :: [LoRaWANDeviceMetadata] -> ShowS
show :: LoRaWANDeviceMetadata -> String
$cshow :: LoRaWANDeviceMetadata -> String
showsPrec :: Int -> LoRaWANDeviceMetadata -> ShowS
$cshowsPrec :: Int -> LoRaWANDeviceMetadata -> ShowS
Prelude.Show, (forall x. LoRaWANDeviceMetadata -> Rep LoRaWANDeviceMetadata x)
-> (forall x. Rep LoRaWANDeviceMetadata x -> LoRaWANDeviceMetadata)
-> Generic LoRaWANDeviceMetadata
forall x. Rep LoRaWANDeviceMetadata x -> LoRaWANDeviceMetadata
forall x. LoRaWANDeviceMetadata -> Rep LoRaWANDeviceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoRaWANDeviceMetadata x -> LoRaWANDeviceMetadata
$cfrom :: forall x. LoRaWANDeviceMetadata -> Rep LoRaWANDeviceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANDeviceMetadata' 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:
--
-- 'frequency', 'loRaWANDeviceMetadata_frequency' - The device\'s channel frequency in Hz.
--
-- 'fPort', 'loRaWANDeviceMetadata_fPort' - The FPort value.
--
-- 'dataRate', 'loRaWANDeviceMetadata_dataRate' - The DataRate value.
--
-- 'gateways', 'loRaWANDeviceMetadata_gateways' - Information about the gateways accessed by the device.
--
-- 'timestamp', 'loRaWANDeviceMetadata_timestamp' - The date and time of the metadata.
--
-- 'devEui', 'loRaWANDeviceMetadata_devEui' - The DevEUI value.
newLoRaWANDeviceMetadata ::
  LoRaWANDeviceMetadata
newLoRaWANDeviceMetadata :: LoRaWANDeviceMetadata
newLoRaWANDeviceMetadata =
  LoRaWANDeviceMetadata' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe [LoRaWANGatewayMetadata]
-> Maybe Text
-> Maybe Text
-> LoRaWANDeviceMetadata
LoRaWANDeviceMetadata'
    { $sel:frequency:LoRaWANDeviceMetadata' :: Maybe Int
frequency = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:fPort:LoRaWANDeviceMetadata' :: Maybe Int
fPort = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dataRate:LoRaWANDeviceMetadata' :: Maybe Int
dataRate = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:gateways:LoRaWANDeviceMetadata' :: Maybe [LoRaWANGatewayMetadata]
gateways = Maybe [LoRaWANGatewayMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:LoRaWANDeviceMetadata' :: Maybe Text
timestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:devEui:LoRaWANDeviceMetadata' :: Maybe Text
devEui = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The device\'s channel frequency in Hz.
loRaWANDeviceMetadata_frequency :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe Prelude.Int)
loRaWANDeviceMetadata_frequency :: (Maybe Int -> f (Maybe Int))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_frequency = (LoRaWANDeviceMetadata -> Maybe Int)
-> (LoRaWANDeviceMetadata -> Maybe Int -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata LoRaWANDeviceMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe Int
frequency :: Maybe Int
$sel:frequency:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe Int
frequency} -> Maybe Int
frequency) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe Int
a -> LoRaWANDeviceMetadata
s {$sel:frequency:LoRaWANDeviceMetadata' :: Maybe Int
frequency = Maybe Int
a} :: LoRaWANDeviceMetadata)

-- | The FPort value.
loRaWANDeviceMetadata_fPort :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe Prelude.Int)
loRaWANDeviceMetadata_fPort :: (Maybe Int -> f (Maybe Int))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_fPort = (LoRaWANDeviceMetadata -> Maybe Int)
-> (LoRaWANDeviceMetadata -> Maybe Int -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata LoRaWANDeviceMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe Int
fPort :: Maybe Int
$sel:fPort:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe Int
fPort} -> Maybe Int
fPort) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe Int
a -> LoRaWANDeviceMetadata
s {$sel:fPort:LoRaWANDeviceMetadata' :: Maybe Int
fPort = Maybe Int
a} :: LoRaWANDeviceMetadata)

-- | The DataRate value.
loRaWANDeviceMetadata_dataRate :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe Prelude.Int)
loRaWANDeviceMetadata_dataRate :: (Maybe Int -> f (Maybe Int))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_dataRate = (LoRaWANDeviceMetadata -> Maybe Int)
-> (LoRaWANDeviceMetadata -> Maybe Int -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata LoRaWANDeviceMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe Int
dataRate :: Maybe Int
$sel:dataRate:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe Int
dataRate} -> Maybe Int
dataRate) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe Int
a -> LoRaWANDeviceMetadata
s {$sel:dataRate:LoRaWANDeviceMetadata' :: Maybe Int
dataRate = Maybe Int
a} :: LoRaWANDeviceMetadata)

-- | Information about the gateways accessed by the device.
loRaWANDeviceMetadata_gateways :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe [LoRaWANGatewayMetadata])
loRaWANDeviceMetadata_gateways :: (Maybe [LoRaWANGatewayMetadata]
 -> f (Maybe [LoRaWANGatewayMetadata]))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_gateways = (LoRaWANDeviceMetadata -> Maybe [LoRaWANGatewayMetadata])
-> (LoRaWANDeviceMetadata
    -> Maybe [LoRaWANGatewayMetadata] -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata
     LoRaWANDeviceMetadata
     (Maybe [LoRaWANGatewayMetadata])
     (Maybe [LoRaWANGatewayMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe [LoRaWANGatewayMetadata]
gateways :: Maybe [LoRaWANGatewayMetadata]
$sel:gateways:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe [LoRaWANGatewayMetadata]
gateways} -> Maybe [LoRaWANGatewayMetadata]
gateways) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe [LoRaWANGatewayMetadata]
a -> LoRaWANDeviceMetadata
s {$sel:gateways:LoRaWANDeviceMetadata' :: Maybe [LoRaWANGatewayMetadata]
gateways = Maybe [LoRaWANGatewayMetadata]
a} :: LoRaWANDeviceMetadata) ((Maybe [LoRaWANGatewayMetadata]
  -> f (Maybe [LoRaWANGatewayMetadata]))
 -> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata)
-> ((Maybe [LoRaWANGatewayMetadata]
     -> f (Maybe [LoRaWANGatewayMetadata]))
    -> Maybe [LoRaWANGatewayMetadata]
    -> f (Maybe [LoRaWANGatewayMetadata]))
-> (Maybe [LoRaWANGatewayMetadata]
    -> f (Maybe [LoRaWANGatewayMetadata]))
-> LoRaWANDeviceMetadata
-> f LoRaWANDeviceMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
-> Iso
     (Maybe [LoRaWANGatewayMetadata])
     (Maybe [LoRaWANGatewayMetadata])
     (Maybe [LoRaWANGatewayMetadata])
     (Maybe [LoRaWANGatewayMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
  [LoRaWANGatewayMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time of the metadata.
loRaWANDeviceMetadata_timestamp :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe Prelude.Text)
loRaWANDeviceMetadata_timestamp :: (Maybe Text -> f (Maybe Text))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_timestamp = (LoRaWANDeviceMetadata -> Maybe Text)
-> (LoRaWANDeviceMetadata -> Maybe Text -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata
     LoRaWANDeviceMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe Text
timestamp :: Maybe Text
$sel:timestamp:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe Text
timestamp} -> Maybe Text
timestamp) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe Text
a -> LoRaWANDeviceMetadata
s {$sel:timestamp:LoRaWANDeviceMetadata' :: Maybe Text
timestamp = Maybe Text
a} :: LoRaWANDeviceMetadata)

-- | The DevEUI value.
loRaWANDeviceMetadata_devEui :: Lens.Lens' LoRaWANDeviceMetadata (Prelude.Maybe Prelude.Text)
loRaWANDeviceMetadata_devEui :: (Maybe Text -> f (Maybe Text))
-> LoRaWANDeviceMetadata -> f LoRaWANDeviceMetadata
loRaWANDeviceMetadata_devEui = (LoRaWANDeviceMetadata -> Maybe Text)
-> (LoRaWANDeviceMetadata -> Maybe Text -> LoRaWANDeviceMetadata)
-> Lens
     LoRaWANDeviceMetadata
     LoRaWANDeviceMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANDeviceMetadata' {Maybe Text
devEui :: Maybe Text
$sel:devEui:LoRaWANDeviceMetadata' :: LoRaWANDeviceMetadata -> Maybe Text
devEui} -> Maybe Text
devEui) (\s :: LoRaWANDeviceMetadata
s@LoRaWANDeviceMetadata' {} Maybe Text
a -> LoRaWANDeviceMetadata
s {$sel:devEui:LoRaWANDeviceMetadata' :: Maybe Text
devEui = Maybe Text
a} :: LoRaWANDeviceMetadata)

instance Core.FromJSON LoRaWANDeviceMetadata where
  parseJSON :: Value -> Parser LoRaWANDeviceMetadata
parseJSON =
    String
-> (Object -> Parser LoRaWANDeviceMetadata)
-> Value
-> Parser LoRaWANDeviceMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANDeviceMetadata"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe [LoRaWANGatewayMetadata]
-> Maybe Text
-> Maybe Text
-> LoRaWANDeviceMetadata
LoRaWANDeviceMetadata'
            (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe [LoRaWANGatewayMetadata]
 -> Maybe Text
 -> Maybe Text
 -> LoRaWANDeviceMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe [LoRaWANGatewayMetadata]
      -> Maybe Text
      -> Maybe Text
      -> LoRaWANDeviceMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Frequency")
            Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe [LoRaWANGatewayMetadata]
   -> Maybe Text
   -> Maybe Text
   -> LoRaWANDeviceMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe [LoRaWANGatewayMetadata]
      -> Maybe Text
      -> Maybe Text
      -> LoRaWANDeviceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FPort")
            Parser
  (Maybe Int
   -> Maybe [LoRaWANGatewayMetadata]
   -> Maybe Text
   -> Maybe Text
   -> LoRaWANDeviceMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe [LoRaWANGatewayMetadata]
      -> Maybe Text -> Maybe Text -> LoRaWANDeviceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataRate")
            Parser
  (Maybe [LoRaWANGatewayMetadata]
   -> Maybe Text -> Maybe Text -> LoRaWANDeviceMetadata)
-> Parser (Maybe [LoRaWANGatewayMetadata])
-> Parser (Maybe Text -> Maybe Text -> LoRaWANDeviceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [LoRaWANGatewayMetadata]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Gateways" Parser (Maybe (Maybe [LoRaWANGatewayMetadata]))
-> Maybe [LoRaWANGatewayMetadata]
-> Parser (Maybe [LoRaWANGatewayMetadata])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LoRaWANGatewayMetadata]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> LoRaWANDeviceMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> LoRaWANDeviceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timestamp")
            Parser (Maybe Text -> LoRaWANDeviceMetadata)
-> Parser (Maybe Text) -> Parser LoRaWANDeviceMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DevEui")
      )

instance Prelude.Hashable LoRaWANDeviceMetadata

instance Prelude.NFData LoRaWANDeviceMetadata