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

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

-- | LoRaWANGatewayVersion object.
--
-- /See:/ 'newLoRaWANGatewayVersion' smart constructor.
data LoRaWANGatewayVersion = LoRaWANGatewayVersion'
  { -- | The version of the wireless gateway firmware.
    LoRaWANGatewayVersion -> Maybe Text
packageVersion :: Prelude.Maybe Prelude.Text,
    -- | The model number of the wireless gateway.
    LoRaWANGatewayVersion -> Maybe Text
model :: Prelude.Maybe Prelude.Text,
    -- | The basic station version of the wireless gateway.
    LoRaWANGatewayVersion -> Maybe Text
station :: Prelude.Maybe Prelude.Text
  }
  deriving (LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool
(LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool)
-> (LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool)
-> Eq LoRaWANGatewayVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool
$c/= :: LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool
== :: LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool
$c== :: LoRaWANGatewayVersion -> LoRaWANGatewayVersion -> Bool
Prelude.Eq, ReadPrec [LoRaWANGatewayVersion]
ReadPrec LoRaWANGatewayVersion
Int -> ReadS LoRaWANGatewayVersion
ReadS [LoRaWANGatewayVersion]
(Int -> ReadS LoRaWANGatewayVersion)
-> ReadS [LoRaWANGatewayVersion]
-> ReadPrec LoRaWANGatewayVersion
-> ReadPrec [LoRaWANGatewayVersion]
-> Read LoRaWANGatewayVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANGatewayVersion]
$creadListPrec :: ReadPrec [LoRaWANGatewayVersion]
readPrec :: ReadPrec LoRaWANGatewayVersion
$creadPrec :: ReadPrec LoRaWANGatewayVersion
readList :: ReadS [LoRaWANGatewayVersion]
$creadList :: ReadS [LoRaWANGatewayVersion]
readsPrec :: Int -> ReadS LoRaWANGatewayVersion
$creadsPrec :: Int -> ReadS LoRaWANGatewayVersion
Prelude.Read, Int -> LoRaWANGatewayVersion -> ShowS
[LoRaWANGatewayVersion] -> ShowS
LoRaWANGatewayVersion -> String
(Int -> LoRaWANGatewayVersion -> ShowS)
-> (LoRaWANGatewayVersion -> String)
-> ([LoRaWANGatewayVersion] -> ShowS)
-> Show LoRaWANGatewayVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANGatewayVersion] -> ShowS
$cshowList :: [LoRaWANGatewayVersion] -> ShowS
show :: LoRaWANGatewayVersion -> String
$cshow :: LoRaWANGatewayVersion -> String
showsPrec :: Int -> LoRaWANGatewayVersion -> ShowS
$cshowsPrec :: Int -> LoRaWANGatewayVersion -> ShowS
Prelude.Show, (forall x. LoRaWANGatewayVersion -> Rep LoRaWANGatewayVersion x)
-> (forall x. Rep LoRaWANGatewayVersion x -> LoRaWANGatewayVersion)
-> Generic LoRaWANGatewayVersion
forall x. Rep LoRaWANGatewayVersion x -> LoRaWANGatewayVersion
forall x. LoRaWANGatewayVersion -> Rep LoRaWANGatewayVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoRaWANGatewayVersion x -> LoRaWANGatewayVersion
$cfrom :: forall x. LoRaWANGatewayVersion -> Rep LoRaWANGatewayVersion x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANGatewayVersion' 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:
--
-- 'packageVersion', 'loRaWANGatewayVersion_packageVersion' - The version of the wireless gateway firmware.
--
-- 'model', 'loRaWANGatewayVersion_model' - The model number of the wireless gateway.
--
-- 'station', 'loRaWANGatewayVersion_station' - The basic station version of the wireless gateway.
newLoRaWANGatewayVersion ::
  LoRaWANGatewayVersion
newLoRaWANGatewayVersion :: LoRaWANGatewayVersion
newLoRaWANGatewayVersion =
  LoRaWANGatewayVersion' :: Maybe Text -> Maybe Text -> Maybe Text -> LoRaWANGatewayVersion
LoRaWANGatewayVersion'
    { $sel:packageVersion:LoRaWANGatewayVersion' :: Maybe Text
packageVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:model:LoRaWANGatewayVersion' :: Maybe Text
model = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:station:LoRaWANGatewayVersion' :: Maybe Text
station = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the wireless gateway firmware.
loRaWANGatewayVersion_packageVersion :: Lens.Lens' LoRaWANGatewayVersion (Prelude.Maybe Prelude.Text)
loRaWANGatewayVersion_packageVersion :: (Maybe Text -> f (Maybe Text))
-> LoRaWANGatewayVersion -> f LoRaWANGatewayVersion
loRaWANGatewayVersion_packageVersion = (LoRaWANGatewayVersion -> Maybe Text)
-> (LoRaWANGatewayVersion -> Maybe Text -> LoRaWANGatewayVersion)
-> Lens
     LoRaWANGatewayVersion
     LoRaWANGatewayVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayVersion' {Maybe Text
packageVersion :: Maybe Text
$sel:packageVersion:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
packageVersion} -> Maybe Text
packageVersion) (\s :: LoRaWANGatewayVersion
s@LoRaWANGatewayVersion' {} Maybe Text
a -> LoRaWANGatewayVersion
s {$sel:packageVersion:LoRaWANGatewayVersion' :: Maybe Text
packageVersion = Maybe Text
a} :: LoRaWANGatewayVersion)

-- | The model number of the wireless gateway.
loRaWANGatewayVersion_model :: Lens.Lens' LoRaWANGatewayVersion (Prelude.Maybe Prelude.Text)
loRaWANGatewayVersion_model :: (Maybe Text -> f (Maybe Text))
-> LoRaWANGatewayVersion -> f LoRaWANGatewayVersion
loRaWANGatewayVersion_model = (LoRaWANGatewayVersion -> Maybe Text)
-> (LoRaWANGatewayVersion -> Maybe Text -> LoRaWANGatewayVersion)
-> Lens
     LoRaWANGatewayVersion
     LoRaWANGatewayVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayVersion' {Maybe Text
model :: Maybe Text
$sel:model:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
model} -> Maybe Text
model) (\s :: LoRaWANGatewayVersion
s@LoRaWANGatewayVersion' {} Maybe Text
a -> LoRaWANGatewayVersion
s {$sel:model:LoRaWANGatewayVersion' :: Maybe Text
model = Maybe Text
a} :: LoRaWANGatewayVersion)

-- | The basic station version of the wireless gateway.
loRaWANGatewayVersion_station :: Lens.Lens' LoRaWANGatewayVersion (Prelude.Maybe Prelude.Text)
loRaWANGatewayVersion_station :: (Maybe Text -> f (Maybe Text))
-> LoRaWANGatewayVersion -> f LoRaWANGatewayVersion
loRaWANGatewayVersion_station = (LoRaWANGatewayVersion -> Maybe Text)
-> (LoRaWANGatewayVersion -> Maybe Text -> LoRaWANGatewayVersion)
-> Lens
     LoRaWANGatewayVersion
     LoRaWANGatewayVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANGatewayVersion' {Maybe Text
station :: Maybe Text
$sel:station:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
station} -> Maybe Text
station) (\s :: LoRaWANGatewayVersion
s@LoRaWANGatewayVersion' {} Maybe Text
a -> LoRaWANGatewayVersion
s {$sel:station:LoRaWANGatewayVersion' :: Maybe Text
station = Maybe Text
a} :: LoRaWANGatewayVersion)

instance Core.FromJSON LoRaWANGatewayVersion where
  parseJSON :: Value -> Parser LoRaWANGatewayVersion
parseJSON =
    String
-> (Object -> Parser LoRaWANGatewayVersion)
-> Value
-> Parser LoRaWANGatewayVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANGatewayVersion"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> LoRaWANGatewayVersion
LoRaWANGatewayVersion'
            (Maybe Text -> Maybe Text -> Maybe Text -> LoRaWANGatewayVersion)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> LoRaWANGatewayVersion)
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
"PackageVersion")
            Parser (Maybe Text -> Maybe Text -> LoRaWANGatewayVersion)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> LoRaWANGatewayVersion)
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
"Model")
            Parser (Maybe Text -> LoRaWANGatewayVersion)
-> Parser (Maybe Text) -> Parser LoRaWANGatewayVersion
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
"Station")
      )

instance Prelude.Hashable LoRaWANGatewayVersion

instance Prelude.NFData LoRaWANGatewayVersion

instance Core.ToJSON LoRaWANGatewayVersion where
  toJSON :: LoRaWANGatewayVersion -> Value
toJSON LoRaWANGatewayVersion' {Maybe Text
station :: Maybe Text
model :: Maybe Text
packageVersion :: Maybe Text
$sel:station:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
$sel:model:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
$sel:packageVersion:LoRaWANGatewayVersion' :: LoRaWANGatewayVersion -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PackageVersion" 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
packageVersion,
            (Text
"Model" 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
model,
            (Text
"Station" 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
station
          ]
      )