{-# 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.LoRaWANUpdateDevice
-- 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.LoRaWANUpdateDevice 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.UpdateAbpV1_0_x
import Amazonka.IoTWireless.Types.UpdateAbpV1_1
import Amazonka.IoTWireless.Types.UpdateFPorts
import qualified Amazonka.Prelude as Prelude

-- | LoRaWAN object for update functions.
--
-- /See:/ 'newLoRaWANUpdateDevice' smart constructor.
data LoRaWANUpdateDevice = LoRaWANUpdateDevice'
  { -- | ABP device object for update APIs for v1.0.x
    LoRaWANUpdateDevice -> Maybe UpdateAbpV1_0_x
abpV1_0_x :: Prelude.Maybe UpdateAbpV1_0_x,
    -- | ABP device object for update APIs for v1.1
    LoRaWANUpdateDevice -> Maybe UpdateAbpV1_1
abpV1_1 :: Prelude.Maybe UpdateAbpV1_1,
    -- | The ID of the device profile for the wireless device.
    LoRaWANUpdateDevice -> Maybe Text
deviceProfileId :: Prelude.Maybe Prelude.Text,
    -- | FPorts object for the positioning information of the device.
    LoRaWANUpdateDevice -> Maybe UpdateFPorts
fPorts :: Prelude.Maybe UpdateFPorts,
    -- | The ID of the service profile.
    LoRaWANUpdateDevice -> Maybe Text
serviceProfileId :: Prelude.Maybe Prelude.Text
  }
  deriving (LoRaWANUpdateDevice -> LoRaWANUpdateDevice -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANUpdateDevice -> LoRaWANUpdateDevice -> Bool
$c/= :: LoRaWANUpdateDevice -> LoRaWANUpdateDevice -> Bool
== :: LoRaWANUpdateDevice -> LoRaWANUpdateDevice -> Bool
$c== :: LoRaWANUpdateDevice -> LoRaWANUpdateDevice -> Bool
Prelude.Eq, ReadPrec [LoRaWANUpdateDevice]
ReadPrec LoRaWANUpdateDevice
Int -> ReadS LoRaWANUpdateDevice
ReadS [LoRaWANUpdateDevice]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANUpdateDevice]
$creadListPrec :: ReadPrec [LoRaWANUpdateDevice]
readPrec :: ReadPrec LoRaWANUpdateDevice
$creadPrec :: ReadPrec LoRaWANUpdateDevice
readList :: ReadS [LoRaWANUpdateDevice]
$creadList :: ReadS [LoRaWANUpdateDevice]
readsPrec :: Int -> ReadS LoRaWANUpdateDevice
$creadsPrec :: Int -> ReadS LoRaWANUpdateDevice
Prelude.Read, Int -> LoRaWANUpdateDevice -> ShowS
[LoRaWANUpdateDevice] -> ShowS
LoRaWANUpdateDevice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANUpdateDevice] -> ShowS
$cshowList :: [LoRaWANUpdateDevice] -> ShowS
show :: LoRaWANUpdateDevice -> String
$cshow :: LoRaWANUpdateDevice -> String
showsPrec :: Int -> LoRaWANUpdateDevice -> ShowS
$cshowsPrec :: Int -> LoRaWANUpdateDevice -> ShowS
Prelude.Show, forall x. Rep LoRaWANUpdateDevice x -> LoRaWANUpdateDevice
forall x. LoRaWANUpdateDevice -> Rep LoRaWANUpdateDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoRaWANUpdateDevice x -> LoRaWANUpdateDevice
$cfrom :: forall x. LoRaWANUpdateDevice -> Rep LoRaWANUpdateDevice x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANUpdateDevice' 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:
--
-- 'abpV1_0_x', 'loRaWANUpdateDevice_abpV1_0_x' - ABP device object for update APIs for v1.0.x
--
-- 'abpV1_1', 'loRaWANUpdateDevice_abpV1_1' - ABP device object for update APIs for v1.1
--
-- 'deviceProfileId', 'loRaWANUpdateDevice_deviceProfileId' - The ID of the device profile for the wireless device.
--
-- 'fPorts', 'loRaWANUpdateDevice_fPorts' - FPorts object for the positioning information of the device.
--
-- 'serviceProfileId', 'loRaWANUpdateDevice_serviceProfileId' - The ID of the service profile.
newLoRaWANUpdateDevice ::
  LoRaWANUpdateDevice
newLoRaWANUpdateDevice :: LoRaWANUpdateDevice
newLoRaWANUpdateDevice =
  LoRaWANUpdateDevice'
    { $sel:abpV1_0_x:LoRaWANUpdateDevice' :: Maybe UpdateAbpV1_0_x
abpV1_0_x = forall a. Maybe a
Prelude.Nothing,
      $sel:abpV1_1:LoRaWANUpdateDevice' :: Maybe UpdateAbpV1_1
abpV1_1 = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceProfileId:LoRaWANUpdateDevice' :: Maybe Text
deviceProfileId = forall a. Maybe a
Prelude.Nothing,
      $sel:fPorts:LoRaWANUpdateDevice' :: Maybe UpdateFPorts
fPorts = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceProfileId:LoRaWANUpdateDevice' :: Maybe Text
serviceProfileId = forall a. Maybe a
Prelude.Nothing
    }

-- | ABP device object for update APIs for v1.0.x
loRaWANUpdateDevice_abpV1_0_x :: Lens.Lens' LoRaWANUpdateDevice (Prelude.Maybe UpdateAbpV1_0_x)
loRaWANUpdateDevice_abpV1_0_x :: Lens' LoRaWANUpdateDevice (Maybe UpdateAbpV1_0_x)
loRaWANUpdateDevice_abpV1_0_x = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateDevice' {Maybe UpdateAbpV1_0_x
abpV1_0_x :: Maybe UpdateAbpV1_0_x
$sel:abpV1_0_x:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_0_x
abpV1_0_x} -> Maybe UpdateAbpV1_0_x
abpV1_0_x) (\s :: LoRaWANUpdateDevice
s@LoRaWANUpdateDevice' {} Maybe UpdateAbpV1_0_x
a -> LoRaWANUpdateDevice
s {$sel:abpV1_0_x:LoRaWANUpdateDevice' :: Maybe UpdateAbpV1_0_x
abpV1_0_x = Maybe UpdateAbpV1_0_x
a} :: LoRaWANUpdateDevice)

-- | ABP device object for update APIs for v1.1
loRaWANUpdateDevice_abpV1_1 :: Lens.Lens' LoRaWANUpdateDevice (Prelude.Maybe UpdateAbpV1_1)
loRaWANUpdateDevice_abpV1_1 :: Lens' LoRaWANUpdateDevice (Maybe UpdateAbpV1_1)
loRaWANUpdateDevice_abpV1_1 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateDevice' {Maybe UpdateAbpV1_1
abpV1_1 :: Maybe UpdateAbpV1_1
$sel:abpV1_1:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_1
abpV1_1} -> Maybe UpdateAbpV1_1
abpV1_1) (\s :: LoRaWANUpdateDevice
s@LoRaWANUpdateDevice' {} Maybe UpdateAbpV1_1
a -> LoRaWANUpdateDevice
s {$sel:abpV1_1:LoRaWANUpdateDevice' :: Maybe UpdateAbpV1_1
abpV1_1 = Maybe UpdateAbpV1_1
a} :: LoRaWANUpdateDevice)

-- | The ID of the device profile for the wireless device.
loRaWANUpdateDevice_deviceProfileId :: Lens.Lens' LoRaWANUpdateDevice (Prelude.Maybe Prelude.Text)
loRaWANUpdateDevice_deviceProfileId :: Lens' LoRaWANUpdateDevice (Maybe Text)
loRaWANUpdateDevice_deviceProfileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateDevice' {Maybe Text
deviceProfileId :: Maybe Text
$sel:deviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
deviceProfileId} -> Maybe Text
deviceProfileId) (\s :: LoRaWANUpdateDevice
s@LoRaWANUpdateDevice' {} Maybe Text
a -> LoRaWANUpdateDevice
s {$sel:deviceProfileId:LoRaWANUpdateDevice' :: Maybe Text
deviceProfileId = Maybe Text
a} :: LoRaWANUpdateDevice)

-- | FPorts object for the positioning information of the device.
loRaWANUpdateDevice_fPorts :: Lens.Lens' LoRaWANUpdateDevice (Prelude.Maybe UpdateFPorts)
loRaWANUpdateDevice_fPorts :: Lens' LoRaWANUpdateDevice (Maybe UpdateFPorts)
loRaWANUpdateDevice_fPorts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateDevice' {Maybe UpdateFPorts
fPorts :: Maybe UpdateFPorts
$sel:fPorts:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateFPorts
fPorts} -> Maybe UpdateFPorts
fPorts) (\s :: LoRaWANUpdateDevice
s@LoRaWANUpdateDevice' {} Maybe UpdateFPorts
a -> LoRaWANUpdateDevice
s {$sel:fPorts:LoRaWANUpdateDevice' :: Maybe UpdateFPorts
fPorts = Maybe UpdateFPorts
a} :: LoRaWANUpdateDevice)

-- | The ID of the service profile.
loRaWANUpdateDevice_serviceProfileId :: Lens.Lens' LoRaWANUpdateDevice (Prelude.Maybe Prelude.Text)
loRaWANUpdateDevice_serviceProfileId :: Lens' LoRaWANUpdateDevice (Maybe Text)
loRaWANUpdateDevice_serviceProfileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateDevice' {Maybe Text
serviceProfileId :: Maybe Text
$sel:serviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
serviceProfileId} -> Maybe Text
serviceProfileId) (\s :: LoRaWANUpdateDevice
s@LoRaWANUpdateDevice' {} Maybe Text
a -> LoRaWANUpdateDevice
s {$sel:serviceProfileId:LoRaWANUpdateDevice' :: Maybe Text
serviceProfileId = Maybe Text
a} :: LoRaWANUpdateDevice)

instance Prelude.Hashable LoRaWANUpdateDevice where
  hashWithSalt :: Int -> LoRaWANUpdateDevice -> Int
hashWithSalt Int
_salt LoRaWANUpdateDevice' {Maybe Text
Maybe UpdateAbpV1_0_x
Maybe UpdateAbpV1_1
Maybe UpdateFPorts
serviceProfileId :: Maybe Text
fPorts :: Maybe UpdateFPorts
deviceProfileId :: Maybe Text
abpV1_1 :: Maybe UpdateAbpV1_1
abpV1_0_x :: Maybe UpdateAbpV1_0_x
$sel:serviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:fPorts:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateFPorts
$sel:deviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:abpV1_1:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_1
$sel:abpV1_0_x:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_0_x
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateAbpV1_0_x
abpV1_0_x
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateAbpV1_1
abpV1_1
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceProfileId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateFPorts
fPorts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceProfileId

instance Prelude.NFData LoRaWANUpdateDevice where
  rnf :: LoRaWANUpdateDevice -> ()
rnf LoRaWANUpdateDevice' {Maybe Text
Maybe UpdateAbpV1_0_x
Maybe UpdateAbpV1_1
Maybe UpdateFPorts
serviceProfileId :: Maybe Text
fPorts :: Maybe UpdateFPorts
deviceProfileId :: Maybe Text
abpV1_1 :: Maybe UpdateAbpV1_1
abpV1_0_x :: Maybe UpdateAbpV1_0_x
$sel:serviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:fPorts:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateFPorts
$sel:deviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:abpV1_1:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_1
$sel:abpV1_0_x:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_0_x
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateAbpV1_0_x
abpV1_0_x
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateAbpV1_1
abpV1_1
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceProfileId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateFPorts
fPorts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceProfileId

instance Data.ToJSON LoRaWANUpdateDevice where
  toJSON :: LoRaWANUpdateDevice -> Value
toJSON LoRaWANUpdateDevice' {Maybe Text
Maybe UpdateAbpV1_0_x
Maybe UpdateAbpV1_1
Maybe UpdateFPorts
serviceProfileId :: Maybe Text
fPorts :: Maybe UpdateFPorts
deviceProfileId :: Maybe Text
abpV1_1 :: Maybe UpdateAbpV1_1
abpV1_0_x :: Maybe UpdateAbpV1_0_x
$sel:serviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:fPorts:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateFPorts
$sel:deviceProfileId:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe Text
$sel:abpV1_1:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_1
$sel:abpV1_0_x:LoRaWANUpdateDevice' :: LoRaWANUpdateDevice -> Maybe UpdateAbpV1_0_x
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AbpV1_0_x" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateAbpV1_0_x
abpV1_0_x,
            (Key
"AbpV1_1" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateAbpV1_1
abpV1_1,
            (Key
"DeviceProfileId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deviceProfileId,
            (Key
"FPorts" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateFPorts
fPorts,
            (Key
"ServiceProfileId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceProfileId
          ]
      )