{-# 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.GroundStation.Types.UplinkSpectrumConfig
-- 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.GroundStation.Types.UplinkSpectrumConfig where

import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types.Frequency
import Amazonka.GroundStation.Types.Polarization
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the uplink spectral @Config@.
--
-- /See:/ 'newUplinkSpectrumConfig' smart constructor.
data UplinkSpectrumConfig = UplinkSpectrumConfig'
  { -- | Polarization of an uplink spectral @Config@. Capturing both
    -- @\"RIGHT_HAND\"@ and @\"LEFT_HAND\"@ polarization requires two separate
    -- configs.
    UplinkSpectrumConfig -> Maybe Polarization
polarization :: Prelude.Maybe Polarization,
    -- | Center frequency of an uplink spectral @Config@. Valid values are
    -- between 2025 to 2120 MHz.
    UplinkSpectrumConfig -> Frequency
centerFrequency :: Frequency
  }
  deriving (UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool
(UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool)
-> (UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool)
-> Eq UplinkSpectrumConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool
$c/= :: UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool
== :: UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool
$c== :: UplinkSpectrumConfig -> UplinkSpectrumConfig -> Bool
Prelude.Eq, ReadPrec [UplinkSpectrumConfig]
ReadPrec UplinkSpectrumConfig
Int -> ReadS UplinkSpectrumConfig
ReadS [UplinkSpectrumConfig]
(Int -> ReadS UplinkSpectrumConfig)
-> ReadS [UplinkSpectrumConfig]
-> ReadPrec UplinkSpectrumConfig
-> ReadPrec [UplinkSpectrumConfig]
-> Read UplinkSpectrumConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UplinkSpectrumConfig]
$creadListPrec :: ReadPrec [UplinkSpectrumConfig]
readPrec :: ReadPrec UplinkSpectrumConfig
$creadPrec :: ReadPrec UplinkSpectrumConfig
readList :: ReadS [UplinkSpectrumConfig]
$creadList :: ReadS [UplinkSpectrumConfig]
readsPrec :: Int -> ReadS UplinkSpectrumConfig
$creadsPrec :: Int -> ReadS UplinkSpectrumConfig
Prelude.Read, Int -> UplinkSpectrumConfig -> ShowS
[UplinkSpectrumConfig] -> ShowS
UplinkSpectrumConfig -> String
(Int -> UplinkSpectrumConfig -> ShowS)
-> (UplinkSpectrumConfig -> String)
-> ([UplinkSpectrumConfig] -> ShowS)
-> Show UplinkSpectrumConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UplinkSpectrumConfig] -> ShowS
$cshowList :: [UplinkSpectrumConfig] -> ShowS
show :: UplinkSpectrumConfig -> String
$cshow :: UplinkSpectrumConfig -> String
showsPrec :: Int -> UplinkSpectrumConfig -> ShowS
$cshowsPrec :: Int -> UplinkSpectrumConfig -> ShowS
Prelude.Show, (forall x. UplinkSpectrumConfig -> Rep UplinkSpectrumConfig x)
-> (forall x. Rep UplinkSpectrumConfig x -> UplinkSpectrumConfig)
-> Generic UplinkSpectrumConfig
forall x. Rep UplinkSpectrumConfig x -> UplinkSpectrumConfig
forall x. UplinkSpectrumConfig -> Rep UplinkSpectrumConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UplinkSpectrumConfig x -> UplinkSpectrumConfig
$cfrom :: forall x. UplinkSpectrumConfig -> Rep UplinkSpectrumConfig x
Prelude.Generic)

-- |
-- Create a value of 'UplinkSpectrumConfig' 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:
--
-- 'polarization', 'uplinkSpectrumConfig_polarization' - Polarization of an uplink spectral @Config@. Capturing both
-- @\"RIGHT_HAND\"@ and @\"LEFT_HAND\"@ polarization requires two separate
-- configs.
--
-- 'centerFrequency', 'uplinkSpectrumConfig_centerFrequency' - Center frequency of an uplink spectral @Config@. Valid values are
-- between 2025 to 2120 MHz.
newUplinkSpectrumConfig ::
  -- | 'centerFrequency'
  Frequency ->
  UplinkSpectrumConfig
newUplinkSpectrumConfig :: Frequency -> UplinkSpectrumConfig
newUplinkSpectrumConfig Frequency
pCenterFrequency_ =
  UplinkSpectrumConfig' :: Maybe Polarization -> Frequency -> UplinkSpectrumConfig
UplinkSpectrumConfig'
    { $sel:polarization:UplinkSpectrumConfig' :: Maybe Polarization
polarization =
        Maybe Polarization
forall a. Maybe a
Prelude.Nothing,
      $sel:centerFrequency:UplinkSpectrumConfig' :: Frequency
centerFrequency = Frequency
pCenterFrequency_
    }

-- | Polarization of an uplink spectral @Config@. Capturing both
-- @\"RIGHT_HAND\"@ and @\"LEFT_HAND\"@ polarization requires two separate
-- configs.
uplinkSpectrumConfig_polarization :: Lens.Lens' UplinkSpectrumConfig (Prelude.Maybe Polarization)
uplinkSpectrumConfig_polarization :: (Maybe Polarization -> f (Maybe Polarization))
-> UplinkSpectrumConfig -> f UplinkSpectrumConfig
uplinkSpectrumConfig_polarization = (UplinkSpectrumConfig -> Maybe Polarization)
-> (UplinkSpectrumConfig
    -> Maybe Polarization -> UplinkSpectrumConfig)
-> Lens
     UplinkSpectrumConfig
     UplinkSpectrumConfig
     (Maybe Polarization)
     (Maybe Polarization)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UplinkSpectrumConfig' {Maybe Polarization
polarization :: Maybe Polarization
$sel:polarization:UplinkSpectrumConfig' :: UplinkSpectrumConfig -> Maybe Polarization
polarization} -> Maybe Polarization
polarization) (\s :: UplinkSpectrumConfig
s@UplinkSpectrumConfig' {} Maybe Polarization
a -> UplinkSpectrumConfig
s {$sel:polarization:UplinkSpectrumConfig' :: Maybe Polarization
polarization = Maybe Polarization
a} :: UplinkSpectrumConfig)

-- | Center frequency of an uplink spectral @Config@. Valid values are
-- between 2025 to 2120 MHz.
uplinkSpectrumConfig_centerFrequency :: Lens.Lens' UplinkSpectrumConfig Frequency
uplinkSpectrumConfig_centerFrequency :: (Frequency -> f Frequency)
-> UplinkSpectrumConfig -> f UplinkSpectrumConfig
uplinkSpectrumConfig_centerFrequency = (UplinkSpectrumConfig -> Frequency)
-> (UplinkSpectrumConfig -> Frequency -> UplinkSpectrumConfig)
-> Lens
     UplinkSpectrumConfig UplinkSpectrumConfig Frequency Frequency
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UplinkSpectrumConfig' {Frequency
centerFrequency :: Frequency
$sel:centerFrequency:UplinkSpectrumConfig' :: UplinkSpectrumConfig -> Frequency
centerFrequency} -> Frequency
centerFrequency) (\s :: UplinkSpectrumConfig
s@UplinkSpectrumConfig' {} Frequency
a -> UplinkSpectrumConfig
s {$sel:centerFrequency:UplinkSpectrumConfig' :: Frequency
centerFrequency = Frequency
a} :: UplinkSpectrumConfig)

instance Core.FromJSON UplinkSpectrumConfig where
  parseJSON :: Value -> Parser UplinkSpectrumConfig
parseJSON =
    String
-> (Object -> Parser UplinkSpectrumConfig)
-> Value
-> Parser UplinkSpectrumConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UplinkSpectrumConfig"
      ( \Object
x ->
          Maybe Polarization -> Frequency -> UplinkSpectrumConfig
UplinkSpectrumConfig'
            (Maybe Polarization -> Frequency -> UplinkSpectrumConfig)
-> Parser (Maybe Polarization)
-> Parser (Frequency -> UplinkSpectrumConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Polarization)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"polarization")
            Parser (Frequency -> UplinkSpectrumConfig)
-> Parser Frequency -> Parser UplinkSpectrumConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Frequency
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"centerFrequency")
      )

instance Prelude.Hashable UplinkSpectrumConfig

instance Prelude.NFData UplinkSpectrumConfig

instance Core.ToJSON UplinkSpectrumConfig where
  toJSON :: UplinkSpectrumConfig -> Value
toJSON UplinkSpectrumConfig' {Maybe Polarization
Frequency
centerFrequency :: Frequency
polarization :: Maybe Polarization
$sel:centerFrequency:UplinkSpectrumConfig' :: UplinkSpectrumConfig -> Frequency
$sel:polarization:UplinkSpectrumConfig' :: UplinkSpectrumConfig -> Maybe Polarization
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"polarization" Text -> Polarization -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Polarization -> Pair) -> Maybe Polarization -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Polarization
polarization,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"centerFrequency" Text -> Frequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Frequency
centerFrequency)
          ]
      )