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

import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types.Eirp
import Amazonka.GroundStation.Types.UplinkSpectrumConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the uplink @Config@ of an antenna.
--
-- /See:/ 'newAntennaUplinkConfig' smart constructor.
data AntennaUplinkConfig = AntennaUplinkConfig'
  { -- | Whether or not uplink transmit is disabled.
    AntennaUplinkConfig -> Maybe Bool
transmitDisabled :: Prelude.Maybe Prelude.Bool,
    -- | Information about the uplink spectral @Config@.
    AntennaUplinkConfig -> UplinkSpectrumConfig
spectrumConfig :: UplinkSpectrumConfig,
    -- | EIRP of the target.
    AntennaUplinkConfig -> Eirp
targetEirp :: Eirp
  }
  deriving (AntennaUplinkConfig -> AntennaUplinkConfig -> Bool
(AntennaUplinkConfig -> AntennaUplinkConfig -> Bool)
-> (AntennaUplinkConfig -> AntennaUplinkConfig -> Bool)
-> Eq AntennaUplinkConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AntennaUplinkConfig -> AntennaUplinkConfig -> Bool
$c/= :: AntennaUplinkConfig -> AntennaUplinkConfig -> Bool
== :: AntennaUplinkConfig -> AntennaUplinkConfig -> Bool
$c== :: AntennaUplinkConfig -> AntennaUplinkConfig -> Bool
Prelude.Eq, ReadPrec [AntennaUplinkConfig]
ReadPrec AntennaUplinkConfig
Int -> ReadS AntennaUplinkConfig
ReadS [AntennaUplinkConfig]
(Int -> ReadS AntennaUplinkConfig)
-> ReadS [AntennaUplinkConfig]
-> ReadPrec AntennaUplinkConfig
-> ReadPrec [AntennaUplinkConfig]
-> Read AntennaUplinkConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AntennaUplinkConfig]
$creadListPrec :: ReadPrec [AntennaUplinkConfig]
readPrec :: ReadPrec AntennaUplinkConfig
$creadPrec :: ReadPrec AntennaUplinkConfig
readList :: ReadS [AntennaUplinkConfig]
$creadList :: ReadS [AntennaUplinkConfig]
readsPrec :: Int -> ReadS AntennaUplinkConfig
$creadsPrec :: Int -> ReadS AntennaUplinkConfig
Prelude.Read, Int -> AntennaUplinkConfig -> ShowS
[AntennaUplinkConfig] -> ShowS
AntennaUplinkConfig -> String
(Int -> AntennaUplinkConfig -> ShowS)
-> (AntennaUplinkConfig -> String)
-> ([AntennaUplinkConfig] -> ShowS)
-> Show AntennaUplinkConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AntennaUplinkConfig] -> ShowS
$cshowList :: [AntennaUplinkConfig] -> ShowS
show :: AntennaUplinkConfig -> String
$cshow :: AntennaUplinkConfig -> String
showsPrec :: Int -> AntennaUplinkConfig -> ShowS
$cshowsPrec :: Int -> AntennaUplinkConfig -> ShowS
Prelude.Show, (forall x. AntennaUplinkConfig -> Rep AntennaUplinkConfig x)
-> (forall x. Rep AntennaUplinkConfig x -> AntennaUplinkConfig)
-> Generic AntennaUplinkConfig
forall x. Rep AntennaUplinkConfig x -> AntennaUplinkConfig
forall x. AntennaUplinkConfig -> Rep AntennaUplinkConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AntennaUplinkConfig x -> AntennaUplinkConfig
$cfrom :: forall x. AntennaUplinkConfig -> Rep AntennaUplinkConfig x
Prelude.Generic)

-- |
-- Create a value of 'AntennaUplinkConfig' 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:
--
-- 'transmitDisabled', 'antennaUplinkConfig_transmitDisabled' - Whether or not uplink transmit is disabled.
--
-- 'spectrumConfig', 'antennaUplinkConfig_spectrumConfig' - Information about the uplink spectral @Config@.
--
-- 'targetEirp', 'antennaUplinkConfig_targetEirp' - EIRP of the target.
newAntennaUplinkConfig ::
  -- | 'spectrumConfig'
  UplinkSpectrumConfig ->
  -- | 'targetEirp'
  Eirp ->
  AntennaUplinkConfig
newAntennaUplinkConfig :: UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig
newAntennaUplinkConfig UplinkSpectrumConfig
pSpectrumConfig_ Eirp
pTargetEirp_ =
  AntennaUplinkConfig' :: Maybe Bool -> UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig
AntennaUplinkConfig'
    { $sel:transmitDisabled:AntennaUplinkConfig' :: Maybe Bool
transmitDisabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:spectrumConfig:AntennaUplinkConfig' :: UplinkSpectrumConfig
spectrumConfig = UplinkSpectrumConfig
pSpectrumConfig_,
      $sel:targetEirp:AntennaUplinkConfig' :: Eirp
targetEirp = Eirp
pTargetEirp_
    }

-- | Whether or not uplink transmit is disabled.
antennaUplinkConfig_transmitDisabled :: Lens.Lens' AntennaUplinkConfig (Prelude.Maybe Prelude.Bool)
antennaUplinkConfig_transmitDisabled :: (Maybe Bool -> f (Maybe Bool))
-> AntennaUplinkConfig -> f AntennaUplinkConfig
antennaUplinkConfig_transmitDisabled = (AntennaUplinkConfig -> Maybe Bool)
-> (AntennaUplinkConfig -> Maybe Bool -> AntennaUplinkConfig)
-> Lens
     AntennaUplinkConfig AntennaUplinkConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AntennaUplinkConfig' {Maybe Bool
transmitDisabled :: Maybe Bool
$sel:transmitDisabled:AntennaUplinkConfig' :: AntennaUplinkConfig -> Maybe Bool
transmitDisabled} -> Maybe Bool
transmitDisabled) (\s :: AntennaUplinkConfig
s@AntennaUplinkConfig' {} Maybe Bool
a -> AntennaUplinkConfig
s {$sel:transmitDisabled:AntennaUplinkConfig' :: Maybe Bool
transmitDisabled = Maybe Bool
a} :: AntennaUplinkConfig)

-- | Information about the uplink spectral @Config@.
antennaUplinkConfig_spectrumConfig :: Lens.Lens' AntennaUplinkConfig UplinkSpectrumConfig
antennaUplinkConfig_spectrumConfig :: (UplinkSpectrumConfig -> f UplinkSpectrumConfig)
-> AntennaUplinkConfig -> f AntennaUplinkConfig
antennaUplinkConfig_spectrumConfig = (AntennaUplinkConfig -> UplinkSpectrumConfig)
-> (AntennaUplinkConfig
    -> UplinkSpectrumConfig -> AntennaUplinkConfig)
-> Lens
     AntennaUplinkConfig
     AntennaUplinkConfig
     UplinkSpectrumConfig
     UplinkSpectrumConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AntennaUplinkConfig' {UplinkSpectrumConfig
spectrumConfig :: UplinkSpectrumConfig
$sel:spectrumConfig:AntennaUplinkConfig' :: AntennaUplinkConfig -> UplinkSpectrumConfig
spectrumConfig} -> UplinkSpectrumConfig
spectrumConfig) (\s :: AntennaUplinkConfig
s@AntennaUplinkConfig' {} UplinkSpectrumConfig
a -> AntennaUplinkConfig
s {$sel:spectrumConfig:AntennaUplinkConfig' :: UplinkSpectrumConfig
spectrumConfig = UplinkSpectrumConfig
a} :: AntennaUplinkConfig)

-- | EIRP of the target.
antennaUplinkConfig_targetEirp :: Lens.Lens' AntennaUplinkConfig Eirp
antennaUplinkConfig_targetEirp :: (Eirp -> f Eirp) -> AntennaUplinkConfig -> f AntennaUplinkConfig
antennaUplinkConfig_targetEirp = (AntennaUplinkConfig -> Eirp)
-> (AntennaUplinkConfig -> Eirp -> AntennaUplinkConfig)
-> Lens AntennaUplinkConfig AntennaUplinkConfig Eirp Eirp
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AntennaUplinkConfig' {Eirp
targetEirp :: Eirp
$sel:targetEirp:AntennaUplinkConfig' :: AntennaUplinkConfig -> Eirp
targetEirp} -> Eirp
targetEirp) (\s :: AntennaUplinkConfig
s@AntennaUplinkConfig' {} Eirp
a -> AntennaUplinkConfig
s {$sel:targetEirp:AntennaUplinkConfig' :: Eirp
targetEirp = Eirp
a} :: AntennaUplinkConfig)

instance Core.FromJSON AntennaUplinkConfig where
  parseJSON :: Value -> Parser AntennaUplinkConfig
parseJSON =
    String
-> (Object -> Parser AntennaUplinkConfig)
-> Value
-> Parser AntennaUplinkConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AntennaUplinkConfig"
      ( \Object
x ->
          Maybe Bool -> UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig
AntennaUplinkConfig'
            (Maybe Bool -> UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig)
-> Parser (Maybe Bool)
-> Parser (UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"transmitDisabled")
            Parser (UplinkSpectrumConfig -> Eirp -> AntennaUplinkConfig)
-> Parser UplinkSpectrumConfig
-> Parser (Eirp -> AntennaUplinkConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser UplinkSpectrumConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spectrumConfig")
            Parser (Eirp -> AntennaUplinkConfig)
-> Parser Eirp -> Parser AntennaUplinkConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Eirp
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"targetEirp")
      )

instance Prelude.Hashable AntennaUplinkConfig

instance Prelude.NFData AntennaUplinkConfig

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