{-# 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 #-}
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
data SpectrumConfig = SpectrumConfig'
{
SpectrumConfig -> Maybe Polarization
polarization :: Prelude.Maybe Polarization,
SpectrumConfig -> FrequencyBandwidth
bandwidth :: FrequencyBandwidth,
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)
newSpectrumConfig ::
FrequencyBandwidth ->
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_
}
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)
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)
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)
]
)