{-# 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.Outposts.Types.AssetLocation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Outposts.Types.AssetLocation where

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

-- | Information about the position of the asset in a rack.
--
-- /See:/ 'newAssetLocation' smart constructor.
data AssetLocation = AssetLocation'
  { -- | The position of an asset in a rack measured in rack units.
    AssetLocation -> Maybe Double
rackElevation :: Prelude.Maybe Prelude.Double
  }
  deriving (AssetLocation -> AssetLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetLocation -> AssetLocation -> Bool
$c/= :: AssetLocation -> AssetLocation -> Bool
== :: AssetLocation -> AssetLocation -> Bool
$c== :: AssetLocation -> AssetLocation -> Bool
Prelude.Eq, ReadPrec [AssetLocation]
ReadPrec AssetLocation
Int -> ReadS AssetLocation
ReadS [AssetLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetLocation]
$creadListPrec :: ReadPrec [AssetLocation]
readPrec :: ReadPrec AssetLocation
$creadPrec :: ReadPrec AssetLocation
readList :: ReadS [AssetLocation]
$creadList :: ReadS [AssetLocation]
readsPrec :: Int -> ReadS AssetLocation
$creadsPrec :: Int -> ReadS AssetLocation
Prelude.Read, Int -> AssetLocation -> ShowS
[AssetLocation] -> ShowS
AssetLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetLocation] -> ShowS
$cshowList :: [AssetLocation] -> ShowS
show :: AssetLocation -> String
$cshow :: AssetLocation -> String
showsPrec :: Int -> AssetLocation -> ShowS
$cshowsPrec :: Int -> AssetLocation -> ShowS
Prelude.Show, forall x. Rep AssetLocation x -> AssetLocation
forall x. AssetLocation -> Rep AssetLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetLocation x -> AssetLocation
$cfrom :: forall x. AssetLocation -> Rep AssetLocation x
Prelude.Generic)

-- |
-- Create a value of 'AssetLocation' 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:
--
-- 'rackElevation', 'assetLocation_rackElevation' - The position of an asset in a rack measured in rack units.
newAssetLocation ::
  AssetLocation
newAssetLocation :: AssetLocation
newAssetLocation =
  AssetLocation' {$sel:rackElevation:AssetLocation' :: Maybe Double
rackElevation = forall a. Maybe a
Prelude.Nothing}

-- | The position of an asset in a rack measured in rack units.
assetLocation_rackElevation :: Lens.Lens' AssetLocation (Prelude.Maybe Prelude.Double)
assetLocation_rackElevation :: Lens' AssetLocation (Maybe Double)
assetLocation_rackElevation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetLocation' {Maybe Double
rackElevation :: Maybe Double
$sel:rackElevation:AssetLocation' :: AssetLocation -> Maybe Double
rackElevation} -> Maybe Double
rackElevation) (\s :: AssetLocation
s@AssetLocation' {} Maybe Double
a -> AssetLocation
s {$sel:rackElevation:AssetLocation' :: Maybe Double
rackElevation = Maybe Double
a} :: AssetLocation)

instance Data.FromJSON AssetLocation where
  parseJSON :: Value -> Parser AssetLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AssetLocation"
      ( \Object
x ->
          Maybe Double -> AssetLocation
AssetLocation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RackElevation")
      )

instance Prelude.Hashable AssetLocation where
  hashWithSalt :: Int -> AssetLocation -> Int
hashWithSalt Int
_salt AssetLocation' {Maybe Double
rackElevation :: Maybe Double
$sel:rackElevation:AssetLocation' :: AssetLocation -> Maybe Double
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
rackElevation

instance Prelude.NFData AssetLocation where
  rnf :: AssetLocation -> ()
rnf AssetLocation' {Maybe Double
rackElevation :: Maybe Double
$sel:rackElevation:AssetLocation' :: AssetLocation -> Maybe Double
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
rackElevation