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

import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types.SpectrumConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about how AWS Ground Station should configure an antenna for
-- downlink during a contact.
--
-- /See:/ 'newAntennaDownlinkConfig' smart constructor.
data AntennaDownlinkConfig = AntennaDownlinkConfig'
  { -- | Object that describes a spectral @Config@.
    AntennaDownlinkConfig -> SpectrumConfig
spectrumConfig :: SpectrumConfig
  }
  deriving (AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool
(AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool)
-> (AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool)
-> Eq AntennaDownlinkConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool
$c/= :: AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool
== :: AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool
$c== :: AntennaDownlinkConfig -> AntennaDownlinkConfig -> Bool
Prelude.Eq, ReadPrec [AntennaDownlinkConfig]
ReadPrec AntennaDownlinkConfig
Int -> ReadS AntennaDownlinkConfig
ReadS [AntennaDownlinkConfig]
(Int -> ReadS AntennaDownlinkConfig)
-> ReadS [AntennaDownlinkConfig]
-> ReadPrec AntennaDownlinkConfig
-> ReadPrec [AntennaDownlinkConfig]
-> Read AntennaDownlinkConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AntennaDownlinkConfig]
$creadListPrec :: ReadPrec [AntennaDownlinkConfig]
readPrec :: ReadPrec AntennaDownlinkConfig
$creadPrec :: ReadPrec AntennaDownlinkConfig
readList :: ReadS [AntennaDownlinkConfig]
$creadList :: ReadS [AntennaDownlinkConfig]
readsPrec :: Int -> ReadS AntennaDownlinkConfig
$creadsPrec :: Int -> ReadS AntennaDownlinkConfig
Prelude.Read, Int -> AntennaDownlinkConfig -> ShowS
[AntennaDownlinkConfig] -> ShowS
AntennaDownlinkConfig -> String
(Int -> AntennaDownlinkConfig -> ShowS)
-> (AntennaDownlinkConfig -> String)
-> ([AntennaDownlinkConfig] -> ShowS)
-> Show AntennaDownlinkConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AntennaDownlinkConfig] -> ShowS
$cshowList :: [AntennaDownlinkConfig] -> ShowS
show :: AntennaDownlinkConfig -> String
$cshow :: AntennaDownlinkConfig -> String
showsPrec :: Int -> AntennaDownlinkConfig -> ShowS
$cshowsPrec :: Int -> AntennaDownlinkConfig -> ShowS
Prelude.Show, (forall x. AntennaDownlinkConfig -> Rep AntennaDownlinkConfig x)
-> (forall x. Rep AntennaDownlinkConfig x -> AntennaDownlinkConfig)
-> Generic AntennaDownlinkConfig
forall x. Rep AntennaDownlinkConfig x -> AntennaDownlinkConfig
forall x. AntennaDownlinkConfig -> Rep AntennaDownlinkConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AntennaDownlinkConfig x -> AntennaDownlinkConfig
$cfrom :: forall x. AntennaDownlinkConfig -> Rep AntennaDownlinkConfig x
Prelude.Generic)

-- |
-- Create a value of 'AntennaDownlinkConfig' 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:
--
-- 'spectrumConfig', 'antennaDownlinkConfig_spectrumConfig' - Object that describes a spectral @Config@.
newAntennaDownlinkConfig ::
  -- | 'spectrumConfig'
  SpectrumConfig ->
  AntennaDownlinkConfig
newAntennaDownlinkConfig :: SpectrumConfig -> AntennaDownlinkConfig
newAntennaDownlinkConfig SpectrumConfig
pSpectrumConfig_ =
  AntennaDownlinkConfig' :: SpectrumConfig -> AntennaDownlinkConfig
AntennaDownlinkConfig'
    { $sel:spectrumConfig:AntennaDownlinkConfig' :: SpectrumConfig
spectrumConfig =
        SpectrumConfig
pSpectrumConfig_
    }

-- | Object that describes a spectral @Config@.
antennaDownlinkConfig_spectrumConfig :: Lens.Lens' AntennaDownlinkConfig SpectrumConfig
antennaDownlinkConfig_spectrumConfig :: (SpectrumConfig -> f SpectrumConfig)
-> AntennaDownlinkConfig -> f AntennaDownlinkConfig
antennaDownlinkConfig_spectrumConfig = (AntennaDownlinkConfig -> SpectrumConfig)
-> (AntennaDownlinkConfig
    -> SpectrumConfig -> AntennaDownlinkConfig)
-> Lens
     AntennaDownlinkConfig
     AntennaDownlinkConfig
     SpectrumConfig
     SpectrumConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AntennaDownlinkConfig' {SpectrumConfig
spectrumConfig :: SpectrumConfig
$sel:spectrumConfig:AntennaDownlinkConfig' :: AntennaDownlinkConfig -> SpectrumConfig
spectrumConfig} -> SpectrumConfig
spectrumConfig) (\s :: AntennaDownlinkConfig
s@AntennaDownlinkConfig' {} SpectrumConfig
a -> AntennaDownlinkConfig
s {$sel:spectrumConfig:AntennaDownlinkConfig' :: SpectrumConfig
spectrumConfig = SpectrumConfig
a} :: AntennaDownlinkConfig)

instance Core.FromJSON AntennaDownlinkConfig where
  parseJSON :: Value -> Parser AntennaDownlinkConfig
parseJSON =
    String
-> (Object -> Parser AntennaDownlinkConfig)
-> Value
-> Parser AntennaDownlinkConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AntennaDownlinkConfig"
      ( \Object
x ->
          SpectrumConfig -> AntennaDownlinkConfig
AntennaDownlinkConfig'
            (SpectrumConfig -> AntennaDownlinkConfig)
-> Parser SpectrumConfig -> Parser AntennaDownlinkConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser SpectrumConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spectrumConfig")
      )

instance Prelude.Hashable AntennaDownlinkConfig

instance Prelude.NFData AntennaDownlinkConfig

instance Core.ToJSON AntennaDownlinkConfig where
  toJSON :: AntennaDownlinkConfig -> Value
toJSON AntennaDownlinkConfig' {SpectrumConfig
spectrumConfig :: SpectrumConfig
$sel:spectrumConfig:AntennaDownlinkConfig' :: AntennaDownlinkConfig -> SpectrumConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"spectrumConfig" Text -> SpectrumConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SpectrumConfig
spectrumConfig)
          ]
      )