{-# 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.DevOpsGuru.Types.PerformanceInsightsStat
-- 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.DevOpsGuru.Types.PerformanceInsightsStat 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

-- | A statistic in a Performance Insights collection.
--
-- /See:/ 'newPerformanceInsightsStat' smart constructor.
data PerformanceInsightsStat = PerformanceInsightsStat'
  { -- | The statistic type.
    PerformanceInsightsStat -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The value of the statistic.
    PerformanceInsightsStat -> Maybe Double
value :: Prelude.Maybe Prelude.Double
  }
  deriving (PerformanceInsightsStat -> PerformanceInsightsStat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PerformanceInsightsStat -> PerformanceInsightsStat -> Bool
$c/= :: PerformanceInsightsStat -> PerformanceInsightsStat -> Bool
== :: PerformanceInsightsStat -> PerformanceInsightsStat -> Bool
$c== :: PerformanceInsightsStat -> PerformanceInsightsStat -> Bool
Prelude.Eq, ReadPrec [PerformanceInsightsStat]
ReadPrec PerformanceInsightsStat
Int -> ReadS PerformanceInsightsStat
ReadS [PerformanceInsightsStat]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PerformanceInsightsStat]
$creadListPrec :: ReadPrec [PerformanceInsightsStat]
readPrec :: ReadPrec PerformanceInsightsStat
$creadPrec :: ReadPrec PerformanceInsightsStat
readList :: ReadS [PerformanceInsightsStat]
$creadList :: ReadS [PerformanceInsightsStat]
readsPrec :: Int -> ReadS PerformanceInsightsStat
$creadsPrec :: Int -> ReadS PerformanceInsightsStat
Prelude.Read, Int -> PerformanceInsightsStat -> ShowS
[PerformanceInsightsStat] -> ShowS
PerformanceInsightsStat -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PerformanceInsightsStat] -> ShowS
$cshowList :: [PerformanceInsightsStat] -> ShowS
show :: PerformanceInsightsStat -> String
$cshow :: PerformanceInsightsStat -> String
showsPrec :: Int -> PerformanceInsightsStat -> ShowS
$cshowsPrec :: Int -> PerformanceInsightsStat -> ShowS
Prelude.Show, forall x. Rep PerformanceInsightsStat x -> PerformanceInsightsStat
forall x. PerformanceInsightsStat -> Rep PerformanceInsightsStat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PerformanceInsightsStat x -> PerformanceInsightsStat
$cfrom :: forall x. PerformanceInsightsStat -> Rep PerformanceInsightsStat x
Prelude.Generic)

-- |
-- Create a value of 'PerformanceInsightsStat' 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:
--
-- 'type'', 'performanceInsightsStat_type' - The statistic type.
--
-- 'value', 'performanceInsightsStat_value' - The value of the statistic.
newPerformanceInsightsStat ::
  PerformanceInsightsStat
newPerformanceInsightsStat :: PerformanceInsightsStat
newPerformanceInsightsStat =
  PerformanceInsightsStat'
    { $sel:type':PerformanceInsightsStat' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:value:PerformanceInsightsStat' :: Maybe Double
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The statistic type.
performanceInsightsStat_type :: Lens.Lens' PerformanceInsightsStat (Prelude.Maybe Prelude.Text)
performanceInsightsStat_type :: Lens' PerformanceInsightsStat (Maybe Text)
performanceInsightsStat_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerformanceInsightsStat' {Maybe Text
type' :: Maybe Text
$sel:type':PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Text
type'} -> Maybe Text
type') (\s :: PerformanceInsightsStat
s@PerformanceInsightsStat' {} Maybe Text
a -> PerformanceInsightsStat
s {$sel:type':PerformanceInsightsStat' :: Maybe Text
type' = Maybe Text
a} :: PerformanceInsightsStat)

-- | The value of the statistic.
performanceInsightsStat_value :: Lens.Lens' PerformanceInsightsStat (Prelude.Maybe Prelude.Double)
performanceInsightsStat_value :: Lens' PerformanceInsightsStat (Maybe Double)
performanceInsightsStat_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerformanceInsightsStat' {Maybe Double
value :: Maybe Double
$sel:value:PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Double
value} -> Maybe Double
value) (\s :: PerformanceInsightsStat
s@PerformanceInsightsStat' {} Maybe Double
a -> PerformanceInsightsStat
s {$sel:value:PerformanceInsightsStat' :: Maybe Double
value = Maybe Double
a} :: PerformanceInsightsStat)

instance Data.FromJSON PerformanceInsightsStat where
  parseJSON :: Value -> Parser PerformanceInsightsStat
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PerformanceInsightsStat"
      ( \Object
x ->
          Maybe Text -> Maybe Double -> PerformanceInsightsStat
PerformanceInsightsStat'
            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
"Type")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Value")
      )

instance Prelude.Hashable PerformanceInsightsStat where
  hashWithSalt :: Int -> PerformanceInsightsStat -> Int
hashWithSalt Int
_salt PerformanceInsightsStat' {Maybe Double
Maybe Text
value :: Maybe Double
type' :: Maybe Text
$sel:value:PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Double
$sel:type':PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
value

instance Prelude.NFData PerformanceInsightsStat where
  rnf :: PerformanceInsightsStat -> ()
rnf PerformanceInsightsStat' {Maybe Double
Maybe Text
value :: Maybe Double
type' :: Maybe Text
$sel:value:PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Double
$sel:type':PerformanceInsightsStat' :: PerformanceInsightsStat -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
value