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

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

-- | Elevation angle of the satellite in the sky during a contact.
--
-- /See:/ 'newElevation' smart constructor.
data Elevation = Elevation'
  { -- | Elevation angle units.
    Elevation -> AngleUnits
unit :: AngleUnits,
    -- | Elevation angle value.
    Elevation -> Double
value :: Prelude.Double
  }
  deriving (Elevation -> Elevation -> Bool
(Elevation -> Elevation -> Bool)
-> (Elevation -> Elevation -> Bool) -> Eq Elevation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Elevation -> Elevation -> Bool
$c/= :: Elevation -> Elevation -> Bool
== :: Elevation -> Elevation -> Bool
$c== :: Elevation -> Elevation -> Bool
Prelude.Eq, ReadPrec [Elevation]
ReadPrec Elevation
Int -> ReadS Elevation
ReadS [Elevation]
(Int -> ReadS Elevation)
-> ReadS [Elevation]
-> ReadPrec Elevation
-> ReadPrec [Elevation]
-> Read Elevation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Elevation]
$creadListPrec :: ReadPrec [Elevation]
readPrec :: ReadPrec Elevation
$creadPrec :: ReadPrec Elevation
readList :: ReadS [Elevation]
$creadList :: ReadS [Elevation]
readsPrec :: Int -> ReadS Elevation
$creadsPrec :: Int -> ReadS Elevation
Prelude.Read, Int -> Elevation -> ShowS
[Elevation] -> ShowS
Elevation -> String
(Int -> Elevation -> ShowS)
-> (Elevation -> String)
-> ([Elevation] -> ShowS)
-> Show Elevation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Elevation] -> ShowS
$cshowList :: [Elevation] -> ShowS
show :: Elevation -> String
$cshow :: Elevation -> String
showsPrec :: Int -> Elevation -> ShowS
$cshowsPrec :: Int -> Elevation -> ShowS
Prelude.Show, (forall x. Elevation -> Rep Elevation x)
-> (forall x. Rep Elevation x -> Elevation) -> Generic Elevation
forall x. Rep Elevation x -> Elevation
forall x. Elevation -> Rep Elevation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Elevation x -> Elevation
$cfrom :: forall x. Elevation -> Rep Elevation x
Prelude.Generic)

-- |
-- Create a value of 'Elevation' 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:
--
-- 'unit', 'elevation_unit' - Elevation angle units.
--
-- 'value', 'elevation_value' - Elevation angle value.
newElevation ::
  -- | 'unit'
  AngleUnits ->
  -- | 'value'
  Prelude.Double ->
  Elevation
newElevation :: AngleUnits -> Double -> Elevation
newElevation AngleUnits
pUnit_ Double
pValue_ =
  Elevation' :: AngleUnits -> Double -> Elevation
Elevation' {$sel:unit:Elevation' :: AngleUnits
unit = AngleUnits
pUnit_, $sel:value:Elevation' :: Double
value = Double
pValue_}

-- | Elevation angle units.
elevation_unit :: Lens.Lens' Elevation AngleUnits
elevation_unit :: (AngleUnits -> f AngleUnits) -> Elevation -> f Elevation
elevation_unit = (Elevation -> AngleUnits)
-> (Elevation -> AngleUnits -> Elevation)
-> Lens Elevation Elevation AngleUnits AngleUnits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Elevation' {AngleUnits
unit :: AngleUnits
$sel:unit:Elevation' :: Elevation -> AngleUnits
unit} -> AngleUnits
unit) (\s :: Elevation
s@Elevation' {} AngleUnits
a -> Elevation
s {$sel:unit:Elevation' :: AngleUnits
unit = AngleUnits
a} :: Elevation)

-- | Elevation angle value.
elevation_value :: Lens.Lens' Elevation Prelude.Double
elevation_value :: (Double -> f Double) -> Elevation -> f Elevation
elevation_value = (Elevation -> Double)
-> (Elevation -> Double -> Elevation)
-> Lens Elevation Elevation Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Elevation' {Double
value :: Double
$sel:value:Elevation' :: Elevation -> Double
value} -> Double
value) (\s :: Elevation
s@Elevation' {} Double
a -> Elevation
s {$sel:value:Elevation' :: Double
value = Double
a} :: Elevation)

instance Core.FromJSON Elevation where
  parseJSON :: Value -> Parser Elevation
parseJSON =
    String -> (Object -> Parser Elevation) -> Value -> Parser Elevation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Elevation"
      ( \Object
x ->
          AngleUnits -> Double -> Elevation
Elevation'
            (AngleUnits -> Double -> Elevation)
-> Parser AngleUnits -> Parser (Double -> Elevation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AngleUnits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"unit") Parser (Double -> Elevation) -> Parser Double -> Parser Elevation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"value")
      )

instance Prelude.Hashable Elevation

instance Prelude.NFData Elevation