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

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

-- | LoRaWANGateway object.
--
-- /See:/ 'newLoRaWANGateway' smart constructor.
data LoRaWANGateway = LoRaWANGateway'
  { -- | The frequency band (RFRegion) value.
    LoRaWANGateway -> Maybe Text
rfRegion :: Prelude.Maybe Prelude.Text,
    LoRaWANGateway -> Maybe [Natural]
subBands :: Prelude.Maybe [Prelude.Natural],
    -- | The gateway\'s EUI value.
    LoRaWANGateway -> Maybe Text
gatewayEui :: Prelude.Maybe Prelude.Text,
    LoRaWANGateway -> Maybe [NonEmpty Text]
joinEuiFilters :: Prelude.Maybe [Prelude.NonEmpty Prelude.Text],
    LoRaWANGateway -> Maybe [Text]
netIdFilters :: Prelude.Maybe [Prelude.Text]
  }
  deriving (LoRaWANGateway -> LoRaWANGateway -> Bool
(LoRaWANGateway -> LoRaWANGateway -> Bool)
-> (LoRaWANGateway -> LoRaWANGateway -> Bool) -> Eq LoRaWANGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANGateway -> LoRaWANGateway -> Bool
$c/= :: LoRaWANGateway -> LoRaWANGateway -> Bool
== :: LoRaWANGateway -> LoRaWANGateway -> Bool
$c== :: LoRaWANGateway -> LoRaWANGateway -> Bool
Prelude.Eq, ReadPrec [LoRaWANGateway]
ReadPrec LoRaWANGateway
Int -> ReadS LoRaWANGateway
ReadS [LoRaWANGateway]
(Int -> ReadS LoRaWANGateway)
-> ReadS [LoRaWANGateway]
-> ReadPrec LoRaWANGateway
-> ReadPrec [LoRaWANGateway]
-> Read LoRaWANGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANGateway]
$creadListPrec :: ReadPrec [LoRaWANGateway]
readPrec :: ReadPrec LoRaWANGateway
$creadPrec :: ReadPrec LoRaWANGateway
readList :: ReadS [LoRaWANGateway]
$creadList :: ReadS [LoRaWANGateway]
readsPrec :: Int -> ReadS LoRaWANGateway
$creadsPrec :: Int -> ReadS LoRaWANGateway
Prelude.Read, Int -> LoRaWANGateway -> ShowS
[LoRaWANGateway] -> ShowS
LoRaWANGateway -> String
(Int -> LoRaWANGateway -> ShowS)
-> (LoRaWANGateway -> String)
-> ([LoRaWANGateway] -> ShowS)
-> Show LoRaWANGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANGateway] -> ShowS
$cshowList :: [LoRaWANGateway] -> ShowS
show :: LoRaWANGateway -> String
$cshow :: LoRaWANGateway -> String
showsPrec :: Int -> LoRaWANGateway -> ShowS
$cshowsPrec :: Int -> LoRaWANGateway -> ShowS
Prelude.Show, (forall x. LoRaWANGateway -> Rep LoRaWANGateway x)
-> (forall x. Rep LoRaWANGateway x -> LoRaWANGateway)
-> Generic LoRaWANGateway
forall x. Rep LoRaWANGateway x -> LoRaWANGateway
forall x. LoRaWANGateway -> Rep LoRaWANGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoRaWANGateway x -> LoRaWANGateway
$cfrom :: forall x. LoRaWANGateway -> Rep LoRaWANGateway x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANGateway' 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:
--
-- 'rfRegion', 'loRaWANGateway_rfRegion' - The frequency band (RFRegion) value.
--
-- 'subBands', 'loRaWANGateway_subBands' - Undocumented member.
--
-- 'gatewayEui', 'loRaWANGateway_gatewayEui' - The gateway\'s EUI value.
--
-- 'joinEuiFilters', 'loRaWANGateway_joinEuiFilters' - Undocumented member.
--
-- 'netIdFilters', 'loRaWANGateway_netIdFilters' - Undocumented member.
newLoRaWANGateway ::
  LoRaWANGateway
newLoRaWANGateway :: LoRaWANGateway
newLoRaWANGateway =
  LoRaWANGateway' :: Maybe Text
-> Maybe [Natural]
-> Maybe Text
-> Maybe [NonEmpty Text]
-> Maybe [Text]
-> LoRaWANGateway
LoRaWANGateway'
    { $sel:rfRegion:LoRaWANGateway' :: Maybe Text
rfRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subBands:LoRaWANGateway' :: Maybe [Natural]
subBands = Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayEui:LoRaWANGateway' :: Maybe Text
gatewayEui = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:joinEuiFilters:LoRaWANGateway' :: Maybe [NonEmpty Text]
joinEuiFilters = Maybe [NonEmpty Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:netIdFilters:LoRaWANGateway' :: Maybe [Text]
netIdFilters = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The frequency band (RFRegion) value.
loRaWANGateway_rfRegion :: Lens.Lens' LoRaWANGateway (Prelude.Maybe Prelude.Text)
loRaWANGateway_rfRegion :: (Maybe Text -> f (Maybe Text))
-> LoRaWANGateway -> f LoRaWANGateway
loRaWANGateway_rfRegion = (LoRaWANGateway -> Maybe Text)
-> (LoRaWANGateway -> Maybe Text -> LoRaWANGateway)
-> Lens LoRaWANGateway LoRaWANGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGateway' {Maybe Text
rfRegion :: Maybe Text
$sel:rfRegion:LoRaWANGateway' :: LoRaWANGateway -> Maybe Text
rfRegion} -> Maybe Text
rfRegion) (\s :: LoRaWANGateway
s@LoRaWANGateway' {} Maybe Text
a -> LoRaWANGateway
s {$sel:rfRegion:LoRaWANGateway' :: Maybe Text
rfRegion = Maybe Text
a} :: LoRaWANGateway)

-- | Undocumented member.
loRaWANGateway_subBands :: Lens.Lens' LoRaWANGateway (Prelude.Maybe [Prelude.Natural])
loRaWANGateway_subBands :: (Maybe [Natural] -> f (Maybe [Natural]))
-> LoRaWANGateway -> f LoRaWANGateway
loRaWANGateway_subBands = (LoRaWANGateway -> Maybe [Natural])
-> (LoRaWANGateway -> Maybe [Natural] -> LoRaWANGateway)
-> Lens
     LoRaWANGateway LoRaWANGateway (Maybe [Natural]) (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGateway' {Maybe [Natural]
subBands :: Maybe [Natural]
$sel:subBands:LoRaWANGateway' :: LoRaWANGateway -> Maybe [Natural]
subBands} -> Maybe [Natural]
subBands) (\s :: LoRaWANGateway
s@LoRaWANGateway' {} Maybe [Natural]
a -> LoRaWANGateway
s {$sel:subBands:LoRaWANGateway' :: Maybe [Natural]
subBands = Maybe [Natural]
a} :: LoRaWANGateway) ((Maybe [Natural] -> f (Maybe [Natural]))
 -> LoRaWANGateway -> f LoRaWANGateway)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
    -> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> LoRaWANGateway
-> f LoRaWANGateway
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
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 [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Undocumented member.
loRaWANGateway_joinEuiFilters :: Lens.Lens' LoRaWANGateway (Prelude.Maybe [Prelude.NonEmpty Prelude.Text])
loRaWANGateway_joinEuiFilters :: (Maybe [NonEmpty Text] -> f (Maybe [NonEmpty Text]))
-> LoRaWANGateway -> f LoRaWANGateway
loRaWANGateway_joinEuiFilters = (LoRaWANGateway -> Maybe [NonEmpty Text])
-> (LoRaWANGateway -> Maybe [NonEmpty Text] -> LoRaWANGateway)
-> Lens
     LoRaWANGateway
     LoRaWANGateway
     (Maybe [NonEmpty Text])
     (Maybe [NonEmpty Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGateway' {Maybe [NonEmpty Text]
joinEuiFilters :: Maybe [NonEmpty Text]
$sel:joinEuiFilters:LoRaWANGateway' :: LoRaWANGateway -> Maybe [NonEmpty Text]
joinEuiFilters} -> Maybe [NonEmpty Text]
joinEuiFilters) (\s :: LoRaWANGateway
s@LoRaWANGateway' {} Maybe [NonEmpty Text]
a -> LoRaWANGateway
s {$sel:joinEuiFilters:LoRaWANGateway' :: Maybe [NonEmpty Text]
joinEuiFilters = Maybe [NonEmpty Text]
a} :: LoRaWANGateway) ((Maybe [NonEmpty Text] -> f (Maybe [NonEmpty Text]))
 -> LoRaWANGateway -> f LoRaWANGateway)
-> ((Maybe [NonEmpty Text] -> f (Maybe [NonEmpty Text]))
    -> Maybe [NonEmpty Text] -> f (Maybe [NonEmpty Text]))
-> (Maybe [NonEmpty Text] -> f (Maybe [NonEmpty Text]))
-> LoRaWANGateway
-> f LoRaWANGateway
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NonEmpty Text] [NonEmpty Text] [NonEmpty Text] [NonEmpty Text]
-> Iso
     (Maybe [NonEmpty Text])
     (Maybe [NonEmpty Text])
     (Maybe [NonEmpty Text])
     (Maybe [NonEmpty Text])
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
  [NonEmpty Text] [NonEmpty Text] [NonEmpty Text] [NonEmpty Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
loRaWANGateway_netIdFilters :: Lens.Lens' LoRaWANGateway (Prelude.Maybe [Prelude.Text])
loRaWANGateway_netIdFilters :: (Maybe [Text] -> f (Maybe [Text]))
-> LoRaWANGateway -> f LoRaWANGateway
loRaWANGateway_netIdFilters = (LoRaWANGateway -> Maybe [Text])
-> (LoRaWANGateway -> Maybe [Text] -> LoRaWANGateway)
-> Lens LoRaWANGateway LoRaWANGateway (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGateway' {Maybe [Text]
netIdFilters :: Maybe [Text]
$sel:netIdFilters:LoRaWANGateway' :: LoRaWANGateway -> Maybe [Text]
netIdFilters} -> Maybe [Text]
netIdFilters) (\s :: LoRaWANGateway
s@LoRaWANGateway' {} Maybe [Text]
a -> LoRaWANGateway
s {$sel:netIdFilters:LoRaWANGateway' :: Maybe [Text]
netIdFilters = Maybe [Text]
a} :: LoRaWANGateway) ((Maybe [Text] -> f (Maybe [Text]))
 -> LoRaWANGateway -> f LoRaWANGateway)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> LoRaWANGateway
-> f LoRaWANGateway
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON LoRaWANGateway where
  parseJSON :: Value -> Parser LoRaWANGateway
parseJSON =
    String
-> (Object -> Parser LoRaWANGateway)
-> Value
-> Parser LoRaWANGateway
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANGateway"
      ( \Object
x ->
          Maybe Text
-> Maybe [Natural]
-> Maybe Text
-> Maybe [NonEmpty Text]
-> Maybe [Text]
-> LoRaWANGateway
LoRaWANGateway'
            (Maybe Text
 -> Maybe [Natural]
 -> Maybe Text
 -> Maybe [NonEmpty Text]
 -> Maybe [Text]
 -> LoRaWANGateway)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Natural]
      -> Maybe Text
      -> Maybe [NonEmpty Text]
      -> Maybe [Text]
      -> LoRaWANGateway)
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
"RfRegion")
            Parser
  (Maybe [Natural]
   -> Maybe Text
   -> Maybe [NonEmpty Text]
   -> Maybe [Text]
   -> LoRaWANGateway)
-> Parser (Maybe [Natural])
-> Parser
     (Maybe Text
      -> Maybe [NonEmpty Text] -> Maybe [Text] -> LoRaWANGateway)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubBands" Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe [NonEmpty Text] -> Maybe [Text] -> LoRaWANGateway)
-> Parser (Maybe Text)
-> Parser (Maybe [NonEmpty Text] -> Maybe [Text] -> LoRaWANGateway)
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
"GatewayEui")
            Parser (Maybe [NonEmpty Text] -> Maybe [Text] -> LoRaWANGateway)
-> Parser (Maybe [NonEmpty Text])
-> Parser (Maybe [Text] -> LoRaWANGateway)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [NonEmpty Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JoinEuiFilters" Parser (Maybe (Maybe [NonEmpty Text]))
-> Maybe [NonEmpty Text] -> Parser (Maybe [NonEmpty Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [NonEmpty Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Text] -> LoRaWANGateway)
-> Parser (Maybe [Text]) -> Parser LoRaWANGateway
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NetIdFilters" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable LoRaWANGateway

instance Prelude.NFData LoRaWANGateway

instance Core.ToJSON LoRaWANGateway where
  toJSON :: LoRaWANGateway -> Value
toJSON LoRaWANGateway' {Maybe [Natural]
Maybe [NonEmpty Text]
Maybe [Text]
Maybe Text
netIdFilters :: Maybe [Text]
joinEuiFilters :: Maybe [NonEmpty Text]
gatewayEui :: Maybe Text
subBands :: Maybe [Natural]
rfRegion :: Maybe Text
$sel:netIdFilters:LoRaWANGateway' :: LoRaWANGateway -> Maybe [Text]
$sel:joinEuiFilters:LoRaWANGateway' :: LoRaWANGateway -> Maybe [NonEmpty Text]
$sel:gatewayEui:LoRaWANGateway' :: LoRaWANGateway -> Maybe Text
$sel:subBands:LoRaWANGateway' :: LoRaWANGateway -> Maybe [Natural]
$sel:rfRegion:LoRaWANGateway' :: LoRaWANGateway -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RfRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
rfRegion,
            (Text
"SubBands" Text -> [Natural] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Natural] -> Pair) -> Maybe [Natural] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Natural]
subBands,
            (Text
"GatewayEui" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gatewayEui,
            (Text
"JoinEuiFilters" Text -> [NonEmpty Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([NonEmpty Text] -> Pair) -> Maybe [NonEmpty Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NonEmpty Text]
joinEuiFilters,
            (Text
"NetIdFilters" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
netIdFilters
          ]
      )