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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | LoRaWAN gateway metatdata.
--
-- /See:/ 'newLoRaWANGatewayMetadata' smart constructor.
data LoRaWANGatewayMetadata = LoRaWANGatewayMetadata'
  { -- | The gateway\'s EUI value.
    LoRaWANGatewayMetadata -> Maybe Text
gatewayEui :: Prelude.Maybe Prelude.Text,
    -- | The SNR value.
    LoRaWANGatewayMetadata -> Maybe Double
snr :: Prelude.Maybe Prelude.Double,
    -- | The RSSI value.
    LoRaWANGatewayMetadata -> Maybe Double
rssi :: Prelude.Maybe Prelude.Double
  }
  deriving (LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool
(LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool)
-> (LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool)
-> Eq LoRaWANGatewayMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool
$c/= :: LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool
== :: LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool
$c== :: LoRaWANGatewayMetadata -> LoRaWANGatewayMetadata -> Bool
Prelude.Eq, ReadPrec [LoRaWANGatewayMetadata]
ReadPrec LoRaWANGatewayMetadata
Int -> ReadS LoRaWANGatewayMetadata
ReadS [LoRaWANGatewayMetadata]
(Int -> ReadS LoRaWANGatewayMetadata)
-> ReadS [LoRaWANGatewayMetadata]
-> ReadPrec LoRaWANGatewayMetadata
-> ReadPrec [LoRaWANGatewayMetadata]
-> Read LoRaWANGatewayMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANGatewayMetadata]
$creadListPrec :: ReadPrec [LoRaWANGatewayMetadata]
readPrec :: ReadPrec LoRaWANGatewayMetadata
$creadPrec :: ReadPrec LoRaWANGatewayMetadata
readList :: ReadS [LoRaWANGatewayMetadata]
$creadList :: ReadS [LoRaWANGatewayMetadata]
readsPrec :: Int -> ReadS LoRaWANGatewayMetadata
$creadsPrec :: Int -> ReadS LoRaWANGatewayMetadata
Prelude.Read, Int -> LoRaWANGatewayMetadata -> ShowS
[LoRaWANGatewayMetadata] -> ShowS
LoRaWANGatewayMetadata -> String
(Int -> LoRaWANGatewayMetadata -> ShowS)
-> (LoRaWANGatewayMetadata -> String)
-> ([LoRaWANGatewayMetadata] -> ShowS)
-> Show LoRaWANGatewayMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANGatewayMetadata] -> ShowS
$cshowList :: [LoRaWANGatewayMetadata] -> ShowS
show :: LoRaWANGatewayMetadata -> String
$cshow :: LoRaWANGatewayMetadata -> String
showsPrec :: Int -> LoRaWANGatewayMetadata -> ShowS
$cshowsPrec :: Int -> LoRaWANGatewayMetadata -> ShowS
Prelude.Show, (forall x. LoRaWANGatewayMetadata -> Rep LoRaWANGatewayMetadata x)
-> (forall x.
    Rep LoRaWANGatewayMetadata x -> LoRaWANGatewayMetadata)
-> Generic LoRaWANGatewayMetadata
forall x. Rep LoRaWANGatewayMetadata x -> LoRaWANGatewayMetadata
forall x. LoRaWANGatewayMetadata -> Rep LoRaWANGatewayMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoRaWANGatewayMetadata x -> LoRaWANGatewayMetadata
$cfrom :: forall x. LoRaWANGatewayMetadata -> Rep LoRaWANGatewayMetadata x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANGatewayMetadata' 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:
--
-- 'gatewayEui', 'loRaWANGatewayMetadata_gatewayEui' - The gateway\'s EUI value.
--
-- 'snr', 'loRaWANGatewayMetadata_snr' - The SNR value.
--
-- 'rssi', 'loRaWANGatewayMetadata_rssi' - The RSSI value.
newLoRaWANGatewayMetadata ::
  LoRaWANGatewayMetadata
newLoRaWANGatewayMetadata :: LoRaWANGatewayMetadata
newLoRaWANGatewayMetadata =
  LoRaWANGatewayMetadata' :: Maybe Text
-> Maybe Double -> Maybe Double -> LoRaWANGatewayMetadata
LoRaWANGatewayMetadata'
    { $sel:gatewayEui:LoRaWANGatewayMetadata' :: Maybe Text
gatewayEui =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snr:LoRaWANGatewayMetadata' :: Maybe Double
snr = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:rssi:LoRaWANGatewayMetadata' :: Maybe Double
rssi = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The gateway\'s EUI value.
loRaWANGatewayMetadata_gatewayEui :: Lens.Lens' LoRaWANGatewayMetadata (Prelude.Maybe Prelude.Text)
loRaWANGatewayMetadata_gatewayEui :: (Maybe Text -> f (Maybe Text))
-> LoRaWANGatewayMetadata -> f LoRaWANGatewayMetadata
loRaWANGatewayMetadata_gatewayEui = (LoRaWANGatewayMetadata -> Maybe Text)
-> (LoRaWANGatewayMetadata -> Maybe Text -> LoRaWANGatewayMetadata)
-> Lens
     LoRaWANGatewayMetadata
     LoRaWANGatewayMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayMetadata' {Maybe Text
gatewayEui :: Maybe Text
$sel:gatewayEui:LoRaWANGatewayMetadata' :: LoRaWANGatewayMetadata -> Maybe Text
gatewayEui} -> Maybe Text
gatewayEui) (\s :: LoRaWANGatewayMetadata
s@LoRaWANGatewayMetadata' {} Maybe Text
a -> LoRaWANGatewayMetadata
s {$sel:gatewayEui:LoRaWANGatewayMetadata' :: Maybe Text
gatewayEui = Maybe Text
a} :: LoRaWANGatewayMetadata)

-- | The SNR value.
loRaWANGatewayMetadata_snr :: Lens.Lens' LoRaWANGatewayMetadata (Prelude.Maybe Prelude.Double)
loRaWANGatewayMetadata_snr :: (Maybe Double -> f (Maybe Double))
-> LoRaWANGatewayMetadata -> f LoRaWANGatewayMetadata
loRaWANGatewayMetadata_snr = (LoRaWANGatewayMetadata -> Maybe Double)
-> (LoRaWANGatewayMetadata
    -> Maybe Double -> LoRaWANGatewayMetadata)
-> Lens
     LoRaWANGatewayMetadata
     LoRaWANGatewayMetadata
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayMetadata' {Maybe Double
snr :: Maybe Double
$sel:snr:LoRaWANGatewayMetadata' :: LoRaWANGatewayMetadata -> Maybe Double
snr} -> Maybe Double
snr) (\s :: LoRaWANGatewayMetadata
s@LoRaWANGatewayMetadata' {} Maybe Double
a -> LoRaWANGatewayMetadata
s {$sel:snr:LoRaWANGatewayMetadata' :: Maybe Double
snr = Maybe Double
a} :: LoRaWANGatewayMetadata)

-- | The RSSI value.
loRaWANGatewayMetadata_rssi :: Lens.Lens' LoRaWANGatewayMetadata (Prelude.Maybe Prelude.Double)
loRaWANGatewayMetadata_rssi :: (Maybe Double -> f (Maybe Double))
-> LoRaWANGatewayMetadata -> f LoRaWANGatewayMetadata
loRaWANGatewayMetadata_rssi = (LoRaWANGatewayMetadata -> Maybe Double)
-> (LoRaWANGatewayMetadata
    -> Maybe Double -> LoRaWANGatewayMetadata)
-> Lens
     LoRaWANGatewayMetadata
     LoRaWANGatewayMetadata
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayMetadata' {Maybe Double
rssi :: Maybe Double
$sel:rssi:LoRaWANGatewayMetadata' :: LoRaWANGatewayMetadata -> Maybe Double
rssi} -> Maybe Double
rssi) (\s :: LoRaWANGatewayMetadata
s@LoRaWANGatewayMetadata' {} Maybe Double
a -> LoRaWANGatewayMetadata
s {$sel:rssi:LoRaWANGatewayMetadata' :: Maybe Double
rssi = Maybe Double
a} :: LoRaWANGatewayMetadata)

instance Core.FromJSON LoRaWANGatewayMetadata where
  parseJSON :: Value -> Parser LoRaWANGatewayMetadata
parseJSON =
    String
-> (Object -> Parser LoRaWANGatewayMetadata)
-> Value
-> Parser LoRaWANGatewayMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANGatewayMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Double -> Maybe Double -> LoRaWANGatewayMetadata
LoRaWANGatewayMetadata'
            (Maybe Text
 -> Maybe Double -> Maybe Double -> LoRaWANGatewayMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Double -> LoRaWANGatewayMetadata)
forall (f :: * -> *) a b. Functor 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
"GatewayEui")
            Parser (Maybe Double -> Maybe Double -> LoRaWANGatewayMetadata)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> LoRaWANGatewayMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Snr")
            Parser (Maybe Double -> LoRaWANGatewayMetadata)
-> Parser (Maybe Double) -> Parser LoRaWANGatewayMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rssi")
      )

instance Prelude.Hashable LoRaWANGatewayMetadata

instance Prelude.NFData LoRaWANGatewayMetadata