{-# 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.SpectrumConfig
-- 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.SpectrumConfig where

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

-- | Object that describes a spectral @Config@.
--
-- /See:/ 'newSpectrumConfig' smart constructor.
data SpectrumConfig = SpectrumConfig'
  { -- | Polarization of a spectral @Config@. Capturing both @\"RIGHT_HAND\"@ and
    -- @\"LEFT_HAND\"@ polarization requires two separate configs.
    SpectrumConfig -> Maybe Polarization
polarization :: Prelude.Maybe Polarization,
    -- | Bandwidth of a spectral @Config@. AWS Ground Station currently has the
    -- following bandwidth limitations:
    --
    -- -   For @AntennaDownlinkDemodDecodeconfig@, valid values are between 125
    --     kHz to 650 MHz.
    --
    -- -   For @AntennaDownlinkconfig@ valid values are between 10 kHz to 54
    --     MHz.
    --
    -- -   For @AntennaUplinkConfig@, valid values are between 10 kHz to 54
    --     MHz.
    SpectrumConfig -> FrequencyBandwidth
bandwidth :: FrequencyBandwidth,
    -- | Center frequency of a spectral @Config@. Valid values are between 2200
    -- to 2300 MHz and 7750 to 8400 MHz for downlink and 2025 to 2120 MHz for
    -- uplink.
    SpectrumConfig -> Frequency
centerFrequency :: Frequency
  }
  deriving (SpectrumConfig -> SpectrumConfig -> Bool
(SpectrumConfig -> SpectrumConfig -> Bool)
-> (SpectrumConfig -> SpectrumConfig -> Bool) -> Eq SpectrumConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpectrumConfig -> SpectrumConfig -> Bool
$c/= :: SpectrumConfig -> SpectrumConfig -> Bool
== :: SpectrumConfig -> SpectrumConfig -> Bool
$c== :: SpectrumConfig -> SpectrumConfig -> Bool
Prelude.Eq, ReadPrec [SpectrumConfig]
ReadPrec SpectrumConfig
Int -> ReadS SpectrumConfig
ReadS [SpectrumConfig]
(Int -> ReadS SpectrumConfig)
-> ReadS [SpectrumConfig]
-> ReadPrec SpectrumConfig
-> ReadPrec [SpectrumConfig]
-> Read SpectrumConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpectrumConfig]
$creadListPrec :: ReadPrec [SpectrumConfig]
readPrec :: ReadPrec SpectrumConfig
$creadPrec :: ReadPrec SpectrumConfig
readList :: ReadS [SpectrumConfig]
$creadList :: ReadS [SpectrumConfig]
readsPrec :: Int -> ReadS SpectrumConfig
$creadsPrec :: Int -> ReadS SpectrumConfig
Prelude.Read, Int -> SpectrumConfig -> ShowS
[SpectrumConfig] -> ShowS
SpectrumConfig -> String
(Int -> SpectrumConfig -> ShowS)
-> (SpectrumConfig -> String)
-> ([SpectrumConfig] -> ShowS)
-> Show SpectrumConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpectrumConfig] -> ShowS
$cshowList :: [SpectrumConfig] -> ShowS
show :: SpectrumConfig -> String
$cshow :: SpectrumConfig -> String
showsPrec :: Int -> SpectrumConfig -> ShowS
$cshowsPrec :: Int -> SpectrumConfig -> ShowS
Prelude.Show, (forall x. SpectrumConfig -> Rep SpectrumConfig x)
-> (forall x. Rep SpectrumConfig x -> SpectrumConfig)
-> Generic SpectrumConfig
forall x. Rep SpectrumConfig x -> SpectrumConfig
forall x. SpectrumConfig -> Rep SpectrumConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpectrumConfig x -> SpectrumConfig
$cfrom :: forall x. SpectrumConfig -> Rep SpectrumConfig x
Prelude.Generic)

-- |
-- Create a value of 'SpectrumConfig' 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', 'spectrumConfig_polarization' - Polarization of a spectral @Config@. Capturing both @\"RIGHT_HAND\"@ and
-- @\"LEFT_HAND\"@ polarization requires two separate configs.
--
-- 'bandwidth', 'spectrumConfig_bandwidth' - Bandwidth of a spectral @Config@. AWS Ground Station currently has the
-- following bandwidth limitations:
--
-- -   For @AntennaDownlinkDemodDecodeconfig@, valid values are between 125
--     kHz to 650 MHz.
--
-- -   For @AntennaDownlinkconfig@ valid values are between 10 kHz to 54
--     MHz.
--
-- -   For @AntennaUplinkConfig@, valid values are between 10 kHz to 54
--     MHz.
--
-- 'centerFrequency', 'spectrumConfig_centerFrequency' - Center frequency of a spectral @Config@. Valid values are between 2200
-- to 2300 MHz and 7750 to 8400 MHz for downlink and 2025 to 2120 MHz for
-- uplink.
newSpectrumConfig ::
  -- | 'bandwidth'
  FrequencyBandwidth ->
  -- | 'centerFrequency'
  Frequency ->
  SpectrumConfig
newSpectrumConfig :: FrequencyBandwidth -> Frequency -> SpectrumConfig
newSpectrumConfig FrequencyBandwidth
pBandwidth_ Frequency
pCenterFrequency_ =
  SpectrumConfig' :: Maybe Polarization
-> FrequencyBandwidth -> Frequency -> SpectrumConfig
SpectrumConfig'
    { $sel:polarization:SpectrumConfig' :: Maybe Polarization
polarization = Maybe Polarization
forall a. Maybe a
Prelude.Nothing,
      $sel:bandwidth:SpectrumConfig' :: FrequencyBandwidth
bandwidth = FrequencyBandwidth
pBandwidth_,
      $sel:centerFrequency:SpectrumConfig' :: Frequency
centerFrequency = Frequency
pCenterFrequency_
    }

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

-- | Bandwidth of a spectral @Config@. AWS Ground Station currently has the
-- following bandwidth limitations:
--
-- -   For @AntennaDownlinkDemodDecodeconfig@, valid values are between 125
--     kHz to 650 MHz.
--
-- -   For @AntennaDownlinkconfig@ valid values are between 10 kHz to 54
--     MHz.
--
-- -   For @AntennaUplinkConfig@, valid values are between 10 kHz to 54
--     MHz.
spectrumConfig_bandwidth :: Lens.Lens' SpectrumConfig FrequencyBandwidth
spectrumConfig_bandwidth :: (FrequencyBandwidth -> f FrequencyBandwidth)
-> SpectrumConfig -> f SpectrumConfig
spectrumConfig_bandwidth = (SpectrumConfig -> FrequencyBandwidth)
-> (SpectrumConfig -> FrequencyBandwidth -> SpectrumConfig)
-> Lens
     SpectrumConfig SpectrumConfig FrequencyBandwidth FrequencyBandwidth
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpectrumConfig' {FrequencyBandwidth
bandwidth :: FrequencyBandwidth
$sel:bandwidth:SpectrumConfig' :: SpectrumConfig -> FrequencyBandwidth
bandwidth} -> FrequencyBandwidth
bandwidth) (\s :: SpectrumConfig
s@SpectrumConfig' {} FrequencyBandwidth
a -> SpectrumConfig
s {$sel:bandwidth:SpectrumConfig' :: FrequencyBandwidth
bandwidth = FrequencyBandwidth
a} :: SpectrumConfig)

-- | Center frequency of a spectral @Config@. Valid values are between 2200
-- to 2300 MHz and 7750 to 8400 MHz for downlink and 2025 to 2120 MHz for
-- uplink.
spectrumConfig_centerFrequency :: Lens.Lens' SpectrumConfig Frequency
spectrumConfig_centerFrequency :: (Frequency -> f Frequency) -> SpectrumConfig -> f SpectrumConfig
spectrumConfig_centerFrequency = (SpectrumConfig -> Frequency)
-> (SpectrumConfig -> Frequency -> SpectrumConfig)
-> Lens SpectrumConfig SpectrumConfig Frequency Frequency
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpectrumConfig' {Frequency
centerFrequency :: Frequency
$sel:centerFrequency:SpectrumConfig' :: SpectrumConfig -> Frequency
centerFrequency} -> Frequency
centerFrequency) (\s :: SpectrumConfig
s@SpectrumConfig' {} Frequency
a -> SpectrumConfig
s {$sel:centerFrequency:SpectrumConfig' :: Frequency
centerFrequency = Frequency
a} :: SpectrumConfig)

instance Core.FromJSON SpectrumConfig where
  parseJSON :: Value -> Parser SpectrumConfig
parseJSON =
    String
-> (Object -> Parser SpectrumConfig)
-> Value
-> Parser SpectrumConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SpectrumConfig"
      ( \Object
x ->
          Maybe Polarization
-> FrequencyBandwidth -> Frequency -> SpectrumConfig
SpectrumConfig'
            (Maybe Polarization
 -> FrequencyBandwidth -> Frequency -> SpectrumConfig)
-> Parser (Maybe Polarization)
-> Parser (FrequencyBandwidth -> Frequency -> SpectrumConfig)
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 (FrequencyBandwidth -> Frequency -> SpectrumConfig)
-> Parser FrequencyBandwidth
-> Parser (Frequency -> SpectrumConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FrequencyBandwidth
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"bandwidth")
            Parser (Frequency -> SpectrumConfig)
-> Parser Frequency -> Parser SpectrumConfig
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 SpectrumConfig

instance Prelude.NFData SpectrumConfig

instance Core.ToJSON SpectrumConfig where
  toJSON :: SpectrumConfig -> Value
toJSON SpectrumConfig' {Maybe Polarization
FrequencyBandwidth
Frequency
centerFrequency :: Frequency
bandwidth :: FrequencyBandwidth
polarization :: Maybe Polarization
$sel:centerFrequency:SpectrumConfig' :: SpectrumConfig -> Frequency
$sel:bandwidth:SpectrumConfig' :: SpectrumConfig -> FrequencyBandwidth
$sel:polarization:SpectrumConfig' :: SpectrumConfig -> 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
"bandwidth" Text -> FrequencyBandwidth -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FrequencyBandwidth
bandwidth),
            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)
          ]
      )