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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an uplink echo @Config@.
--
-- Parameters from the @AntennaUplinkConfig@, corresponding to the
-- specified @AntennaUplinkConfigArn@, are used when this
-- @UplinkEchoConfig@ is used in a contact.
--
-- /See:/ 'newUplinkEchoConfig' smart constructor.
data UplinkEchoConfig = UplinkEchoConfig'
  { -- | ARN of an uplink @Config@.
    UplinkEchoConfig -> Text
antennaUplinkConfigArn :: Prelude.Text,
    -- | Whether or not an uplink @Config@ is enabled.
    UplinkEchoConfig -> Bool
enabled :: Prelude.Bool
  }
  deriving (UplinkEchoConfig -> UplinkEchoConfig -> Bool
(UplinkEchoConfig -> UplinkEchoConfig -> Bool)
-> (UplinkEchoConfig -> UplinkEchoConfig -> Bool)
-> Eq UplinkEchoConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UplinkEchoConfig -> UplinkEchoConfig -> Bool
$c/= :: UplinkEchoConfig -> UplinkEchoConfig -> Bool
== :: UplinkEchoConfig -> UplinkEchoConfig -> Bool
$c== :: UplinkEchoConfig -> UplinkEchoConfig -> Bool
Prelude.Eq, ReadPrec [UplinkEchoConfig]
ReadPrec UplinkEchoConfig
Int -> ReadS UplinkEchoConfig
ReadS [UplinkEchoConfig]
(Int -> ReadS UplinkEchoConfig)
-> ReadS [UplinkEchoConfig]
-> ReadPrec UplinkEchoConfig
-> ReadPrec [UplinkEchoConfig]
-> Read UplinkEchoConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UplinkEchoConfig]
$creadListPrec :: ReadPrec [UplinkEchoConfig]
readPrec :: ReadPrec UplinkEchoConfig
$creadPrec :: ReadPrec UplinkEchoConfig
readList :: ReadS [UplinkEchoConfig]
$creadList :: ReadS [UplinkEchoConfig]
readsPrec :: Int -> ReadS UplinkEchoConfig
$creadsPrec :: Int -> ReadS UplinkEchoConfig
Prelude.Read, Int -> UplinkEchoConfig -> ShowS
[UplinkEchoConfig] -> ShowS
UplinkEchoConfig -> String
(Int -> UplinkEchoConfig -> ShowS)
-> (UplinkEchoConfig -> String)
-> ([UplinkEchoConfig] -> ShowS)
-> Show UplinkEchoConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UplinkEchoConfig] -> ShowS
$cshowList :: [UplinkEchoConfig] -> ShowS
show :: UplinkEchoConfig -> String
$cshow :: UplinkEchoConfig -> String
showsPrec :: Int -> UplinkEchoConfig -> ShowS
$cshowsPrec :: Int -> UplinkEchoConfig -> ShowS
Prelude.Show, (forall x. UplinkEchoConfig -> Rep UplinkEchoConfig x)
-> (forall x. Rep UplinkEchoConfig x -> UplinkEchoConfig)
-> Generic UplinkEchoConfig
forall x. Rep UplinkEchoConfig x -> UplinkEchoConfig
forall x. UplinkEchoConfig -> Rep UplinkEchoConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UplinkEchoConfig x -> UplinkEchoConfig
$cfrom :: forall x. UplinkEchoConfig -> Rep UplinkEchoConfig x
Prelude.Generic)

-- |
-- Create a value of 'UplinkEchoConfig' 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:
--
-- 'antennaUplinkConfigArn', 'uplinkEchoConfig_antennaUplinkConfigArn' - ARN of an uplink @Config@.
--
-- 'enabled', 'uplinkEchoConfig_enabled' - Whether or not an uplink @Config@ is enabled.
newUplinkEchoConfig ::
  -- | 'antennaUplinkConfigArn'
  Prelude.Text ->
  -- | 'enabled'
  Prelude.Bool ->
  UplinkEchoConfig
newUplinkEchoConfig :: Text -> Bool -> UplinkEchoConfig
newUplinkEchoConfig
  Text
pAntennaUplinkConfigArn_
  Bool
pEnabled_ =
    UplinkEchoConfig' :: Text -> Bool -> UplinkEchoConfig
UplinkEchoConfig'
      { $sel:antennaUplinkConfigArn:UplinkEchoConfig' :: Text
antennaUplinkConfigArn =
          Text
pAntennaUplinkConfigArn_,
        $sel:enabled:UplinkEchoConfig' :: Bool
enabled = Bool
pEnabled_
      }

-- | ARN of an uplink @Config@.
uplinkEchoConfig_antennaUplinkConfigArn :: Lens.Lens' UplinkEchoConfig Prelude.Text
uplinkEchoConfig_antennaUplinkConfigArn :: (Text -> f Text) -> UplinkEchoConfig -> f UplinkEchoConfig
uplinkEchoConfig_antennaUplinkConfigArn = (UplinkEchoConfig -> Text)
-> (UplinkEchoConfig -> Text -> UplinkEchoConfig)
-> Lens UplinkEchoConfig UplinkEchoConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UplinkEchoConfig' {Text
antennaUplinkConfigArn :: Text
$sel:antennaUplinkConfigArn:UplinkEchoConfig' :: UplinkEchoConfig -> Text
antennaUplinkConfigArn} -> Text
antennaUplinkConfigArn) (\s :: UplinkEchoConfig
s@UplinkEchoConfig' {} Text
a -> UplinkEchoConfig
s {$sel:antennaUplinkConfigArn:UplinkEchoConfig' :: Text
antennaUplinkConfigArn = Text
a} :: UplinkEchoConfig)

-- | Whether or not an uplink @Config@ is enabled.
uplinkEchoConfig_enabled :: Lens.Lens' UplinkEchoConfig Prelude.Bool
uplinkEchoConfig_enabled :: (Bool -> f Bool) -> UplinkEchoConfig -> f UplinkEchoConfig
uplinkEchoConfig_enabled = (UplinkEchoConfig -> Bool)
-> (UplinkEchoConfig -> Bool -> UplinkEchoConfig)
-> Lens UplinkEchoConfig UplinkEchoConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UplinkEchoConfig' {Bool
enabled :: Bool
$sel:enabled:UplinkEchoConfig' :: UplinkEchoConfig -> Bool
enabled} -> Bool
enabled) (\s :: UplinkEchoConfig
s@UplinkEchoConfig' {} Bool
a -> UplinkEchoConfig
s {$sel:enabled:UplinkEchoConfig' :: Bool
enabled = Bool
a} :: UplinkEchoConfig)

instance Core.FromJSON UplinkEchoConfig where
  parseJSON :: Value -> Parser UplinkEchoConfig
parseJSON =
    String
-> (Object -> Parser UplinkEchoConfig)
-> Value
-> Parser UplinkEchoConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UplinkEchoConfig"
      ( \Object
x ->
          Text -> Bool -> UplinkEchoConfig
UplinkEchoConfig'
            (Text -> Bool -> UplinkEchoConfig)
-> Parser Text -> Parser (Bool -> UplinkEchoConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"antennaUplinkConfigArn")
            Parser (Bool -> UplinkEchoConfig)
-> Parser Bool -> Parser UplinkEchoConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"enabled")
      )

instance Prelude.Hashable UplinkEchoConfig

instance Prelude.NFData UplinkEchoConfig

instance Core.ToJSON UplinkEchoConfig where
  toJSON :: UplinkEchoConfig -> Value
toJSON UplinkEchoConfig' {Bool
Text
enabled :: Bool
antennaUplinkConfigArn :: Text
$sel:enabled:UplinkEchoConfig' :: UplinkEchoConfig -> Bool
$sel:antennaUplinkConfigArn:UplinkEchoConfig' :: UplinkEchoConfig -> Text
..} =
    [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
"antennaUplinkConfigArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
antennaUplinkConfigArn
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enabled)
          ]
      )