{-# 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.FPorts
-- 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.FPorts 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.ApplicationConfig
import Amazonka.IoTWireless.Types.Positioning
import qualified Amazonka.Prelude as Prelude

-- | List of FPort assigned for different LoRaWAN application packages to use
--
-- /See:/ 'newFPorts' smart constructor.
data FPorts = FPorts'
  { -- | Optional LoRaWAN application information, which can be used for
    -- geolocation.
    FPorts -> Maybe [ApplicationConfig]
applications :: Prelude.Maybe [ApplicationConfig],
    FPorts -> Maybe Natural
clockSync :: Prelude.Maybe Prelude.Natural,
    FPorts -> Maybe Natural
fuota :: Prelude.Maybe Prelude.Natural,
    FPorts -> Maybe Natural
multicast :: Prelude.Maybe Prelude.Natural,
    -- | FPort values for the GNSS, stream, and ClockSync functions of the
    -- positioning information.
    FPorts -> Maybe Positioning
positioning :: Prelude.Maybe Positioning
  }
  deriving (FPorts -> FPorts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FPorts -> FPorts -> Bool
$c/= :: FPorts -> FPorts -> Bool
== :: FPorts -> FPorts -> Bool
$c== :: FPorts -> FPorts -> Bool
Prelude.Eq, ReadPrec [FPorts]
ReadPrec FPorts
Int -> ReadS FPorts
ReadS [FPorts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FPorts]
$creadListPrec :: ReadPrec [FPorts]
readPrec :: ReadPrec FPorts
$creadPrec :: ReadPrec FPorts
readList :: ReadS [FPorts]
$creadList :: ReadS [FPorts]
readsPrec :: Int -> ReadS FPorts
$creadsPrec :: Int -> ReadS FPorts
Prelude.Read, Int -> FPorts -> ShowS
[FPorts] -> ShowS
FPorts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FPorts] -> ShowS
$cshowList :: [FPorts] -> ShowS
show :: FPorts -> String
$cshow :: FPorts -> String
showsPrec :: Int -> FPorts -> ShowS
$cshowsPrec :: Int -> FPorts -> ShowS
Prelude.Show, forall x. Rep FPorts x -> FPorts
forall x. FPorts -> Rep FPorts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FPorts x -> FPorts
$cfrom :: forall x. FPorts -> Rep FPorts x
Prelude.Generic)

-- |
-- Create a value of 'FPorts' 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:
--
-- 'applications', 'fPorts_applications' - Optional LoRaWAN application information, which can be used for
-- geolocation.
--
-- 'clockSync', 'fPorts_clockSync' - Undocumented member.
--
-- 'fuota', 'fPorts_fuota' - Undocumented member.
--
-- 'multicast', 'fPorts_multicast' - Undocumented member.
--
-- 'positioning', 'fPorts_positioning' - FPort values for the GNSS, stream, and ClockSync functions of the
-- positioning information.
newFPorts ::
  FPorts
newFPorts :: FPorts
newFPorts =
  FPorts'
    { $sel:applications:FPorts' :: Maybe [ApplicationConfig]
applications = forall a. Maybe a
Prelude.Nothing,
      $sel:clockSync:FPorts' :: Maybe Natural
clockSync = forall a. Maybe a
Prelude.Nothing,
      $sel:fuota:FPorts' :: Maybe Natural
fuota = forall a. Maybe a
Prelude.Nothing,
      $sel:multicast:FPorts' :: Maybe Natural
multicast = forall a. Maybe a
Prelude.Nothing,
      $sel:positioning:FPorts' :: Maybe Positioning
positioning = forall a. Maybe a
Prelude.Nothing
    }

-- | Optional LoRaWAN application information, which can be used for
-- geolocation.
fPorts_applications :: Lens.Lens' FPorts (Prelude.Maybe [ApplicationConfig])
fPorts_applications :: Lens' FPorts (Maybe [ApplicationConfig])
fPorts_applications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FPorts' {Maybe [ApplicationConfig]
applications :: Maybe [ApplicationConfig]
$sel:applications:FPorts' :: FPorts -> Maybe [ApplicationConfig]
applications} -> Maybe [ApplicationConfig]
applications) (\s :: FPorts
s@FPorts' {} Maybe [ApplicationConfig]
a -> FPorts
s {$sel:applications:FPorts' :: Maybe [ApplicationConfig]
applications = Maybe [ApplicationConfig]
a} :: FPorts) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
fPorts_clockSync :: Lens.Lens' FPorts (Prelude.Maybe Prelude.Natural)
fPorts_clockSync :: Lens' FPorts (Maybe Natural)
fPorts_clockSync = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FPorts' {Maybe Natural
clockSync :: Maybe Natural
$sel:clockSync:FPorts' :: FPorts -> Maybe Natural
clockSync} -> Maybe Natural
clockSync) (\s :: FPorts
s@FPorts' {} Maybe Natural
a -> FPorts
s {$sel:clockSync:FPorts' :: Maybe Natural
clockSync = Maybe Natural
a} :: FPorts)

-- | Undocumented member.
fPorts_fuota :: Lens.Lens' FPorts (Prelude.Maybe Prelude.Natural)
fPorts_fuota :: Lens' FPorts (Maybe Natural)
fPorts_fuota = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FPorts' {Maybe Natural
fuota :: Maybe Natural
$sel:fuota:FPorts' :: FPorts -> Maybe Natural
fuota} -> Maybe Natural
fuota) (\s :: FPorts
s@FPorts' {} Maybe Natural
a -> FPorts
s {$sel:fuota:FPorts' :: Maybe Natural
fuota = Maybe Natural
a} :: FPorts)

-- | Undocumented member.
fPorts_multicast :: Lens.Lens' FPorts (Prelude.Maybe Prelude.Natural)
fPorts_multicast :: Lens' FPorts (Maybe Natural)
fPorts_multicast = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FPorts' {Maybe Natural
multicast :: Maybe Natural
$sel:multicast:FPorts' :: FPorts -> Maybe Natural
multicast} -> Maybe Natural
multicast) (\s :: FPorts
s@FPorts' {} Maybe Natural
a -> FPorts
s {$sel:multicast:FPorts' :: Maybe Natural
multicast = Maybe Natural
a} :: FPorts)

-- | FPort values for the GNSS, stream, and ClockSync functions of the
-- positioning information.
fPorts_positioning :: Lens.Lens' FPorts (Prelude.Maybe Positioning)
fPorts_positioning :: Lens' FPorts (Maybe Positioning)
fPorts_positioning = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FPorts' {Maybe Positioning
positioning :: Maybe Positioning
$sel:positioning:FPorts' :: FPorts -> Maybe Positioning
positioning} -> Maybe Positioning
positioning) (\s :: FPorts
s@FPorts' {} Maybe Positioning
a -> FPorts
s {$sel:positioning:FPorts' :: Maybe Positioning
positioning = Maybe Positioning
a} :: FPorts)

instance Data.FromJSON FPorts where
  parseJSON :: Value -> Parser FPorts
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FPorts"
      ( \Object
x ->
          Maybe [ApplicationConfig]
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Positioning
-> FPorts
FPorts'
            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
"Applications" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ClockSync")
            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
"Fuota")
            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
"Multicast")
            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
"Positioning")
      )

instance Prelude.Hashable FPorts where
  hashWithSalt :: Int -> FPorts -> Int
hashWithSalt Int
_salt FPorts' {Maybe Natural
Maybe [ApplicationConfig]
Maybe Positioning
positioning :: Maybe Positioning
multicast :: Maybe Natural
fuota :: Maybe Natural
clockSync :: Maybe Natural
applications :: Maybe [ApplicationConfig]
$sel:positioning:FPorts' :: FPorts -> Maybe Positioning
$sel:multicast:FPorts' :: FPorts -> Maybe Natural
$sel:fuota:FPorts' :: FPorts -> Maybe Natural
$sel:clockSync:FPorts' :: FPorts -> Maybe Natural
$sel:applications:FPorts' :: FPorts -> Maybe [ApplicationConfig]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ApplicationConfig]
applications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
clockSync
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
fuota
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
multicast
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Positioning
positioning

instance Prelude.NFData FPorts where
  rnf :: FPorts -> ()
rnf FPorts' {Maybe Natural
Maybe [ApplicationConfig]
Maybe Positioning
positioning :: Maybe Positioning
multicast :: Maybe Natural
fuota :: Maybe Natural
clockSync :: Maybe Natural
applications :: Maybe [ApplicationConfig]
$sel:positioning:FPorts' :: FPorts -> Maybe Positioning
$sel:multicast:FPorts' :: FPorts -> Maybe Natural
$sel:fuota:FPorts' :: FPorts -> Maybe Natural
$sel:clockSync:FPorts' :: FPorts -> Maybe Natural
$sel:applications:FPorts' :: FPorts -> Maybe [ApplicationConfig]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ApplicationConfig]
applications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
clockSync
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
fuota
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
multicast
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Positioning
positioning

instance Data.ToJSON FPorts where
  toJSON :: FPorts -> Value
toJSON FPorts' {Maybe Natural
Maybe [ApplicationConfig]
Maybe Positioning
positioning :: Maybe Positioning
multicast :: Maybe Natural
fuota :: Maybe Natural
clockSync :: Maybe Natural
applications :: Maybe [ApplicationConfig]
$sel:positioning:FPorts' :: FPorts -> Maybe Positioning
$sel:multicast:FPorts' :: FPorts -> Maybe Natural
$sel:fuota:FPorts' :: FPorts -> Maybe Natural
$sel:clockSync:FPorts' :: FPorts -> Maybe Natural
$sel:applications:FPorts' :: FPorts -> Maybe [ApplicationConfig]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Applications" 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 [ApplicationConfig]
applications,
            (Key
"ClockSync" 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 Natural
clockSync,
            (Key
"Fuota" 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 Natural
fuota,
            (Key
"Multicast" 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 Natural
multicast,
            (Key
"Positioning" 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 Positioning
positioning
          ]
      )