{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTWireless.Types.LoRaWANUpdateGatewayTaskEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types.LoRaWANGatewayVersion
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
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]
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
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.
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'
    { $sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
currentVersion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: Maybe LoRaWANGatewayVersion
updateVersion = 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 :: Lens' LoRaWANUpdateGatewayTaskEntry (Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskEntry_currentVersion = 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 :: Lens' LoRaWANUpdateGatewayTaskEntry (Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskEntry_updateVersion = 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 Data.FromJSON LoRaWANUpdateGatewayTaskEntry where
  parseJSON :: Value -> Parser LoRaWANUpdateGatewayTaskEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LoRaWANUpdateGatewayTaskEntry"
      ( \Object
x ->
          Maybe LoRaWANGatewayVersion
-> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskEntry
LoRaWANUpdateGatewayTaskEntry'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CurrentVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UpdateVersion")
      )

instance
  Prelude.Hashable
    LoRaWANUpdateGatewayTaskEntry
  where
  hashWithSalt :: Int -> LoRaWANUpdateGatewayTaskEntry -> Int
hashWithSalt Int
_salt LoRaWANUpdateGatewayTaskEntry' {Maybe LoRaWANGatewayVersion
updateVersion :: Maybe LoRaWANGatewayVersion
currentVersion :: Maybe LoRaWANGatewayVersion
$sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
$sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LoRaWANGatewayVersion
currentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LoRaWANGatewayVersion
updateVersion

instance Prelude.NFData LoRaWANUpdateGatewayTaskEntry where
  rnf :: LoRaWANUpdateGatewayTaskEntry -> ()
rnf LoRaWANUpdateGatewayTaskEntry' {Maybe LoRaWANGatewayVersion
updateVersion :: Maybe LoRaWANGatewayVersion
currentVersion :: Maybe LoRaWANGatewayVersion
$sel:updateVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
$sel:currentVersion:LoRaWANUpdateGatewayTaskEntry' :: LoRaWANUpdateGatewayTaskEntry -> Maybe LoRaWANGatewayVersion
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LoRaWANGatewayVersion
currentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LoRaWANGatewayVersion
updateVersion