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

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

-- | Object that determines whether tracking should be used during a contact
-- executed with this @Config@ in the mission profile.
--
-- /See:/ 'newTrackingConfig' smart constructor.
data TrackingConfig = TrackingConfig'
  { -- | Current setting for autotrack.
    TrackingConfig -> Criticality
autotrack :: Criticality
  }
  deriving (TrackingConfig -> TrackingConfig -> Bool
(TrackingConfig -> TrackingConfig -> Bool)
-> (TrackingConfig -> TrackingConfig -> Bool) -> Eq TrackingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrackingConfig -> TrackingConfig -> Bool
$c/= :: TrackingConfig -> TrackingConfig -> Bool
== :: TrackingConfig -> TrackingConfig -> Bool
$c== :: TrackingConfig -> TrackingConfig -> Bool
Prelude.Eq, ReadPrec [TrackingConfig]
ReadPrec TrackingConfig
Int -> ReadS TrackingConfig
ReadS [TrackingConfig]
(Int -> ReadS TrackingConfig)
-> ReadS [TrackingConfig]
-> ReadPrec TrackingConfig
-> ReadPrec [TrackingConfig]
-> Read TrackingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrackingConfig]
$creadListPrec :: ReadPrec [TrackingConfig]
readPrec :: ReadPrec TrackingConfig
$creadPrec :: ReadPrec TrackingConfig
readList :: ReadS [TrackingConfig]
$creadList :: ReadS [TrackingConfig]
readsPrec :: Int -> ReadS TrackingConfig
$creadsPrec :: Int -> ReadS TrackingConfig
Prelude.Read, Int -> TrackingConfig -> ShowS
[TrackingConfig] -> ShowS
TrackingConfig -> String
(Int -> TrackingConfig -> ShowS)
-> (TrackingConfig -> String)
-> ([TrackingConfig] -> ShowS)
-> Show TrackingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrackingConfig] -> ShowS
$cshowList :: [TrackingConfig] -> ShowS
show :: TrackingConfig -> String
$cshow :: TrackingConfig -> String
showsPrec :: Int -> TrackingConfig -> ShowS
$cshowsPrec :: Int -> TrackingConfig -> ShowS
Prelude.Show, (forall x. TrackingConfig -> Rep TrackingConfig x)
-> (forall x. Rep TrackingConfig x -> TrackingConfig)
-> Generic TrackingConfig
forall x. Rep TrackingConfig x -> TrackingConfig
forall x. TrackingConfig -> Rep TrackingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrackingConfig x -> TrackingConfig
$cfrom :: forall x. TrackingConfig -> Rep TrackingConfig x
Prelude.Generic)

-- |
-- Create a value of 'TrackingConfig' 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:
--
-- 'autotrack', 'trackingConfig_autotrack' - Current setting for autotrack.
newTrackingConfig ::
  -- | 'autotrack'
  Criticality ->
  TrackingConfig
newTrackingConfig :: Criticality -> TrackingConfig
newTrackingConfig Criticality
pAutotrack_ =
  TrackingConfig' :: Criticality -> TrackingConfig
TrackingConfig' {$sel:autotrack:TrackingConfig' :: Criticality
autotrack = Criticality
pAutotrack_}

-- | Current setting for autotrack.
trackingConfig_autotrack :: Lens.Lens' TrackingConfig Criticality
trackingConfig_autotrack :: (Criticality -> f Criticality)
-> TrackingConfig -> f TrackingConfig
trackingConfig_autotrack = (TrackingConfig -> Criticality)
-> (TrackingConfig -> Criticality -> TrackingConfig)
-> Lens TrackingConfig TrackingConfig Criticality Criticality
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrackingConfig' {Criticality
autotrack :: Criticality
$sel:autotrack:TrackingConfig' :: TrackingConfig -> Criticality
autotrack} -> Criticality
autotrack) (\s :: TrackingConfig
s@TrackingConfig' {} Criticality
a -> TrackingConfig
s {$sel:autotrack:TrackingConfig' :: Criticality
autotrack = Criticality
a} :: TrackingConfig)

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

instance Prelude.Hashable TrackingConfig

instance Prelude.NFData TrackingConfig

instance Core.ToJSON TrackingConfig where
  toJSON :: TrackingConfig -> Value
toJSON TrackingConfig' {Criticality
autotrack :: Criticality
$sel:autotrack:TrackingConfig' :: TrackingConfig -> Criticality
..} =
    [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
"autotrack" Text -> Criticality -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Criticality
autotrack)]
      )