{-# 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.GsmNmrObj
-- 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.GsmNmrObj 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.GlobalIdentity
import qualified Amazonka.Prelude as Prelude

-- | GSM object for network measurement reports.
--
-- /See:/ 'newGsmNmrObj' smart constructor.
data GsmNmrObj = GsmNmrObj'
  { -- | Global identity information of the GSM object.
    GsmNmrObj -> Maybe GlobalIdentity
globalIdentity :: Prelude.Maybe GlobalIdentity,
    -- | Rx level, which is the received signal power, measured in dBm
    -- (decibel-milliwatts).
    GsmNmrObj -> Maybe Int
rxLevel :: Prelude.Maybe Prelude.Int,
    -- | GSM base station identity code (BSIC).
    GsmNmrObj -> Natural
bsic :: Prelude.Natural,
    -- | GSM broadcast control channel.
    GsmNmrObj -> Natural
bcch :: Prelude.Natural
  }
  deriving (GsmNmrObj -> GsmNmrObj -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GsmNmrObj -> GsmNmrObj -> Bool
$c/= :: GsmNmrObj -> GsmNmrObj -> Bool
== :: GsmNmrObj -> GsmNmrObj -> Bool
$c== :: GsmNmrObj -> GsmNmrObj -> Bool
Prelude.Eq, ReadPrec [GsmNmrObj]
ReadPrec GsmNmrObj
Int -> ReadS GsmNmrObj
ReadS [GsmNmrObj]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GsmNmrObj]
$creadListPrec :: ReadPrec [GsmNmrObj]
readPrec :: ReadPrec GsmNmrObj
$creadPrec :: ReadPrec GsmNmrObj
readList :: ReadS [GsmNmrObj]
$creadList :: ReadS [GsmNmrObj]
readsPrec :: Int -> ReadS GsmNmrObj
$creadsPrec :: Int -> ReadS GsmNmrObj
Prelude.Read, Int -> GsmNmrObj -> ShowS
[GsmNmrObj] -> ShowS
GsmNmrObj -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GsmNmrObj] -> ShowS
$cshowList :: [GsmNmrObj] -> ShowS
show :: GsmNmrObj -> String
$cshow :: GsmNmrObj -> String
showsPrec :: Int -> GsmNmrObj -> ShowS
$cshowsPrec :: Int -> GsmNmrObj -> ShowS
Prelude.Show, forall x. Rep GsmNmrObj x -> GsmNmrObj
forall x. GsmNmrObj -> Rep GsmNmrObj x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GsmNmrObj x -> GsmNmrObj
$cfrom :: forall x. GsmNmrObj -> Rep GsmNmrObj x
Prelude.Generic)

-- |
-- Create a value of 'GsmNmrObj' 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:
--
-- 'globalIdentity', 'gsmNmrObj_globalIdentity' - Global identity information of the GSM object.
--
-- 'rxLevel', 'gsmNmrObj_rxLevel' - Rx level, which is the received signal power, measured in dBm
-- (decibel-milliwatts).
--
-- 'bsic', 'gsmNmrObj_bsic' - GSM base station identity code (BSIC).
--
-- 'bcch', 'gsmNmrObj_bcch' - GSM broadcast control channel.
newGsmNmrObj ::
  -- | 'bsic'
  Prelude.Natural ->
  -- | 'bcch'
  Prelude.Natural ->
  GsmNmrObj
newGsmNmrObj :: Natural -> Natural -> GsmNmrObj
newGsmNmrObj Natural
pBsic_ Natural
pBcch_ =
  GsmNmrObj'
    { $sel:globalIdentity:GsmNmrObj' :: Maybe GlobalIdentity
globalIdentity = forall a. Maybe a
Prelude.Nothing,
      $sel:rxLevel:GsmNmrObj' :: Maybe Int
rxLevel = forall a. Maybe a
Prelude.Nothing,
      $sel:bsic:GsmNmrObj' :: Natural
bsic = Natural
pBsic_,
      $sel:bcch:GsmNmrObj' :: Natural
bcch = Natural
pBcch_
    }

-- | Global identity information of the GSM object.
gsmNmrObj_globalIdentity :: Lens.Lens' GsmNmrObj (Prelude.Maybe GlobalIdentity)
gsmNmrObj_globalIdentity :: Lens' GsmNmrObj (Maybe GlobalIdentity)
gsmNmrObj_globalIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GsmNmrObj' {Maybe GlobalIdentity
globalIdentity :: Maybe GlobalIdentity
$sel:globalIdentity:GsmNmrObj' :: GsmNmrObj -> Maybe GlobalIdentity
globalIdentity} -> Maybe GlobalIdentity
globalIdentity) (\s :: GsmNmrObj
s@GsmNmrObj' {} Maybe GlobalIdentity
a -> GsmNmrObj
s {$sel:globalIdentity:GsmNmrObj' :: Maybe GlobalIdentity
globalIdentity = Maybe GlobalIdentity
a} :: GsmNmrObj)

-- | Rx level, which is the received signal power, measured in dBm
-- (decibel-milliwatts).
gsmNmrObj_rxLevel :: Lens.Lens' GsmNmrObj (Prelude.Maybe Prelude.Int)
gsmNmrObj_rxLevel :: Lens' GsmNmrObj (Maybe Int)
gsmNmrObj_rxLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GsmNmrObj' {Maybe Int
rxLevel :: Maybe Int
$sel:rxLevel:GsmNmrObj' :: GsmNmrObj -> Maybe Int
rxLevel} -> Maybe Int
rxLevel) (\s :: GsmNmrObj
s@GsmNmrObj' {} Maybe Int
a -> GsmNmrObj
s {$sel:rxLevel:GsmNmrObj' :: Maybe Int
rxLevel = Maybe Int
a} :: GsmNmrObj)

-- | GSM base station identity code (BSIC).
gsmNmrObj_bsic :: Lens.Lens' GsmNmrObj Prelude.Natural
gsmNmrObj_bsic :: Lens' GsmNmrObj Natural
gsmNmrObj_bsic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GsmNmrObj' {Natural
bsic :: Natural
$sel:bsic:GsmNmrObj' :: GsmNmrObj -> Natural
bsic} -> Natural
bsic) (\s :: GsmNmrObj
s@GsmNmrObj' {} Natural
a -> GsmNmrObj
s {$sel:bsic:GsmNmrObj' :: Natural
bsic = Natural
a} :: GsmNmrObj)

-- | GSM broadcast control channel.
gsmNmrObj_bcch :: Lens.Lens' GsmNmrObj Prelude.Natural
gsmNmrObj_bcch :: Lens' GsmNmrObj Natural
gsmNmrObj_bcch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GsmNmrObj' {Natural
bcch :: Natural
$sel:bcch:GsmNmrObj' :: GsmNmrObj -> Natural
bcch} -> Natural
bcch) (\s :: GsmNmrObj
s@GsmNmrObj' {} Natural
a -> GsmNmrObj
s {$sel:bcch:GsmNmrObj' :: Natural
bcch = Natural
a} :: GsmNmrObj)

instance Prelude.Hashable GsmNmrObj where
  hashWithSalt :: Int -> GsmNmrObj -> Int
hashWithSalt Int
_salt GsmNmrObj' {Natural
Maybe Int
Maybe GlobalIdentity
bcch :: Natural
bsic :: Natural
rxLevel :: Maybe Int
globalIdentity :: Maybe GlobalIdentity
$sel:bcch:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:bsic:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:rxLevel:GsmNmrObj' :: GsmNmrObj -> Maybe Int
$sel:globalIdentity:GsmNmrObj' :: GsmNmrObj -> Maybe GlobalIdentity
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GlobalIdentity
globalIdentity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
rxLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
bsic
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
bcch

instance Prelude.NFData GsmNmrObj where
  rnf :: GsmNmrObj -> ()
rnf GsmNmrObj' {Natural
Maybe Int
Maybe GlobalIdentity
bcch :: Natural
bsic :: Natural
rxLevel :: Maybe Int
globalIdentity :: Maybe GlobalIdentity
$sel:bcch:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:bsic:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:rxLevel:GsmNmrObj' :: GsmNmrObj -> Maybe Int
$sel:globalIdentity:GsmNmrObj' :: GsmNmrObj -> Maybe GlobalIdentity
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GlobalIdentity
globalIdentity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
rxLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
bsic
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
bcch

instance Data.ToJSON GsmNmrObj where
  toJSON :: GsmNmrObj -> Value
toJSON GsmNmrObj' {Natural
Maybe Int
Maybe GlobalIdentity
bcch :: Natural
bsic :: Natural
rxLevel :: Maybe Int
globalIdentity :: Maybe GlobalIdentity
$sel:bcch:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:bsic:GsmNmrObj' :: GsmNmrObj -> Natural
$sel:rxLevel:GsmNmrObj' :: GsmNmrObj -> Maybe Int
$sel:globalIdentity:GsmNmrObj' :: GsmNmrObj -> Maybe GlobalIdentity
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"GlobalIdentity" 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 GlobalIdentity
globalIdentity,
            (Key
"RxLevel" 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 Int
rxLevel,
            forall a. a -> Maybe a
Prelude.Just (Key
"Bsic" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
bsic),
            forall a. a -> Maybe a
Prelude.Just (Key
"Bcch" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
bcch)
          ]
      )