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

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

-- | LoRaWANUpdateGatewayTaskEntry object.
--
-- /See:/ 'newLoRaWANUpdateGatewayTaskEntry' smart constructor.
data LoRaWANUpdateGatewayTaskEntry = LoRaWANUpdateGatewayTaskEntry'
  { -- | The version of the gateways that should receive the update.
    LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
currentVersion :: Prelude.Maybe LoRaWANGatewayVersion,
    -- | The firmware version to update the gateway to.
    LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
updateVersion :: Prelude.Maybe LoRaWANGatewayVersion
  }
  deriving (LoRaWANUpdateGatewayTaskEntry
-> LoRaWANUpdateGatewayTaskEntry -> Bool
(LoRaWANUpdateGatewayTaskEntry
 -> LoRaWANUpdateGatewayTaskEntry -> Bool)
-> (LoRaWANUpdateGatewayTaskEntry
    -> LoRaWANUpdateGatewayTaskEntry -> Bool)
-> Eq LoRaWANUpdateGatewayTaskEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANUpdateGatewayTaskEntry
-> LoRaWANUpdateGatewayTaskEntry -> Bool
$c/= :: LoRaWANUpdateGatewayTaskEntry
-> LoRaWANUpdateGatewayTaskEntry -> Bool
== :: LoRaWANUpdateGatewayTaskEntry
-> LoRaWANUpdateGatewayTaskEntry -> Bool
$c== :: LoRaWANUpdateGatewayTaskEntry
-> LoRaWANUpdateGatewayTaskEntry -> Bool
Prelude.Eq, ReadPrec [LoRaWANUpdateGatewayTaskEntry]
ReadPrec LoRaWANUpdateGatewayTaskEntry
Int -> ReadS LoRaWANUpdateGatewayTaskEntry
ReadS [LoRaWANUpdateGatewayTaskEntry]
(Int -> ReadS LoRaWANUpdateGatewayTaskEntry)
-> ReadS [LoRaWANUpdateGatewayTaskEntry]
-> ReadPrec LoRaWANUpdateGatewayTaskEntry
-> ReadPrec [LoRaWANUpdateGatewayTaskEntry]
-> Read LoRaWANUpdateGatewayTaskEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANUpdateGatewayTaskEntry]
$creadListPrec :: ReadPrec [LoRaWANUpdateGatewayTaskEntry]
readPrec :: ReadPrec LoRaWANUpdateGatewayTaskEntry
$creadPrec :: ReadPrec LoRaWANUpdateGatewayTaskEntry
readList :: ReadS [LoRaWANUpdateGatewayTaskEntry]
$creadList :: ReadS [LoRaWANUpdateGatewayTaskEntry]
readsPrec :: Int -> ReadS LoRaWANUpdateGatewayTaskEntry
$creadsPrec :: Int -> ReadS LoRaWANUpdateGatewayTaskEntry
Prelude.Read, Int -> LoRaWANUpdateGatewayTaskEntry -> ShowS
[LoRaWANUpdateGatewayTaskEntry] -> ShowS
LoRaWANUpdateGatewayTaskEntry -> String
(Int -> LoRaWANUpdateGatewayTaskEntry -> ShowS)
-> (LoRaWANUpdateGatewayTaskEntry -> String)
-> ([LoRaWANUpdateGatewayTaskEntry] -> ShowS)
-> Show LoRaWANUpdateGatewayTaskEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANUpdateGatewayTaskEntry] -> ShowS
$cshowList :: [LoRaWANUpdateGatewayTaskEntry] -> ShowS
show :: LoRaWANUpdateGatewayTaskEntry -> String
$cshow :: LoRaWANUpdateGatewayTaskEntry -> String
showsPrec :: Int -> LoRaWANUpdateGatewayTaskEntry -> ShowS
$cshowsPrec :: Int -> LoRaWANUpdateGatewayTaskEntry -> ShowS
Prelude.Show, (forall x.
 LoRaWANUpdateGatewayTaskEntry
 -> Rep LoRaWANUpdateGatewayTaskEntry x)
-> (forall x.
    Rep LoRaWANUpdateGatewayTaskEntry x
    -> LoRaWANUpdateGatewayTaskEntry)
-> Generic LoRaWANUpdateGatewayTaskEntry
forall x.
Rep LoRaWANUpdateGatewayTaskEntry x
-> LoRaWANUpdateGatewayTaskEntry
forall x.
LoRaWANUpdateGatewayTaskEntry
-> Rep LoRaWANUpdateGatewayTaskEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LoRaWANUpdateGatewayTaskEntry x
-> LoRaWANUpdateGatewayTaskEntry
$cfrom :: forall x.
LoRaWANUpdateGatewayTaskEntry
-> Rep LoRaWANUpdateGatewayTaskEntry x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANUpdateGatewayTaskEntry' 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:
--
-- 'currentVersion', 'loRaWANUpdateGatewayTaskEntry_currentVersion' - The version of the gateways that should receive the update.
--
-- 'updateVersion', 'loRaWANUpdateGatewayTaskEntry_updateVersion' - The firmware version to update the gateway to.
newLoRaWANUpdateGatewayTaskEntry ::
  LoRaWANUpdateGatewayTaskEntry
newLoRaWANUpdateGatewayTaskEntry :: LoRaWANUpdateGatewayTaskEntry
newLoRaWANUpdateGatewayTaskEntry =
  LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
-> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry
LoRaWANUpdateGatewayTaskEntry'
    { $sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
currentVersion =
        Maybe LoRaWANGatewayVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
updateVersion = Maybe LoRaWANGatewayVersion
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the gateways that should receive the update.
loRaWANUpdateGatewayTaskEntry_currentVersion :: Lens.Lens' LoRaWANUpdateGatewayTaskEntry (Prelude.Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskEntry_currentVersion :: (Maybe LoRaWANGatewayVersion -> f (Maybe LoRaWANGatewayVersion))
-> LoRaWANUpdateGatewayTaskEntry -> f LoRaWANUpdateGatewayTaskEntry
loRaWANUpdateGatewayTaskEntry_currentVersion = (LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion)
-> (LoRaWANUpdateGatewayTaskEntry
    -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry)
-> Lens
     LoRaWANUpdateGatewayTaskEntry
     LoRaWANUpdateGatewayTaskEntry
     (Maybe LoRaWANGatewayVersion)
     (Maybe LoRaWANGatewayVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskEntry' {Maybe LoRaWANGatewayVersion
currentVersion :: Maybe LoRaWANGatewayVersion
$sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
currentVersion} -> Maybe LoRaWANGatewayVersion
currentVersion) (\s :: LoRaWANUpdateGatewayTaskEntry
s@LoRaWANUpdateGatewayTaskEntry' {} Maybe LoRaWANGatewayVersion
a -> LoRaWANUpdateGatewayTaskEntry
s {$sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
currentVersion = Maybe LoRaWANGatewayVersion
a} :: LoRaWANUpdateGatewayTaskEntry)

-- | The firmware version to update the gateway to.
loRaWANUpdateGatewayTaskEntry_updateVersion :: Lens.Lens' LoRaWANUpdateGatewayTaskEntry (Prelude.Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskEntry_updateVersion :: (Maybe LoRaWANGatewayVersion -> f (Maybe LoRaWANGatewayVersion))
-> LoRaWANUpdateGatewayTaskEntry -> f LoRaWANUpdateGatewayTaskEntry
loRaWANUpdateGatewayTaskEntry_updateVersion = (LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion)
-> (LoRaWANUpdateGatewayTaskEntry
    -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry)
-> Lens
     LoRaWANUpdateGatewayTaskEntry
     LoRaWANUpdateGatewayTaskEntry
     (Maybe LoRaWANGatewayVersion)
     (Maybe LoRaWANGatewayVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskEntry' {Maybe LoRaWANGatewayVersion
updateVersion :: Maybe LoRaWANGatewayVersion
$sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
updateVersion} -> Maybe LoRaWANGatewayVersion
updateVersion) (\s :: LoRaWANUpdateGatewayTaskEntry
s@LoRaWANUpdateGatewayTaskEntry' {} Maybe LoRaWANGatewayVersion
a -> LoRaWANUpdateGatewayTaskEntry
s {$sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
updateVersion = Maybe LoRaWANGatewayVersion
a} :: LoRaWANUpdateGatewayTaskEntry)

instance Core.FromJSON LoRaWANUpdateGatewayTaskEntry where
  parseJSON :: Value -> Parser LoRaWANUpdateGatewayTaskEntry
parseJSON =
    String
-> (Object -> Parser LoRaWANUpdateGatewayTaskEntry)
-> Value
-> Parser LoRaWANUpdateGatewayTaskEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANUpdateGatewayTaskEntry"
      ( \Object
x ->
          Maybe LoRaWANGatewayVersion
-> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry
LoRaWANUpdateGatewayTaskEntry'
            (Maybe LoRaWANGatewayVersion
 -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry)
-> Parser (Maybe LoRaWANGatewayVersion)
-> Parser
     (Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LoRaWANGatewayVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentVersion")
            Parser
  (Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry)
-> Parser (Maybe LoRaWANGatewayVersion)
-> Parser LoRaWANUpdateGatewayTaskEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LoRaWANGatewayVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateVersion")
      )

instance
  Prelude.Hashable
    LoRaWANUpdateGatewayTaskEntry

instance Prelude.NFData LoRaWANUpdateGatewayTaskEntry