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

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

-- | Information about the number of open reactive and proactive insights
-- that can be used to gauge the health of your system.
--
-- /See:/ 'newInsightHealth' smart constructor.
data InsightHealth = InsightHealth'
  { -- | The Meant Time to Recover (MTTR) for the insight.
    InsightHealth -> Maybe Integer
meanTimeToRecoverInMilliseconds :: Prelude.Maybe Prelude.Integer,
    -- | The number of open reactive insights.
    InsightHealth -> Maybe Int
openReactiveInsights :: Prelude.Maybe Prelude.Int,
    -- | The number of open proactive insights.
    InsightHealth -> Maybe Int
openProactiveInsights :: Prelude.Maybe Prelude.Int
  }
  deriving (InsightHealth -> InsightHealth -> Bool
(InsightHealth -> InsightHealth -> Bool)
-> (InsightHealth -> InsightHealth -> Bool) -> Eq InsightHealth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsightHealth -> InsightHealth -> Bool
$c/= :: InsightHealth -> InsightHealth -> Bool
== :: InsightHealth -> InsightHealth -> Bool
$c== :: InsightHealth -> InsightHealth -> Bool
Prelude.Eq, ReadPrec [InsightHealth]
ReadPrec InsightHealth
Int -> ReadS InsightHealth
ReadS [InsightHealth]
(Int -> ReadS InsightHealth)
-> ReadS [InsightHealth]
-> ReadPrec InsightHealth
-> ReadPrec [InsightHealth]
-> Read InsightHealth
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InsightHealth]
$creadListPrec :: ReadPrec [InsightHealth]
readPrec :: ReadPrec InsightHealth
$creadPrec :: ReadPrec InsightHealth
readList :: ReadS [InsightHealth]
$creadList :: ReadS [InsightHealth]
readsPrec :: Int -> ReadS InsightHealth
$creadsPrec :: Int -> ReadS InsightHealth
Prelude.Read, Int -> InsightHealth -> ShowS
[InsightHealth] -> ShowS
InsightHealth -> String
(Int -> InsightHealth -> ShowS)
-> (InsightHealth -> String)
-> ([InsightHealth] -> ShowS)
-> Show InsightHealth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsightHealth] -> ShowS
$cshowList :: [InsightHealth] -> ShowS
show :: InsightHealth -> String
$cshow :: InsightHealth -> String
showsPrec :: Int -> InsightHealth -> ShowS
$cshowsPrec :: Int -> InsightHealth -> ShowS
Prelude.Show, (forall x. InsightHealth -> Rep InsightHealth x)
-> (forall x. Rep InsightHealth x -> InsightHealth)
-> Generic InsightHealth
forall x. Rep InsightHealth x -> InsightHealth
forall x. InsightHealth -> Rep InsightHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InsightHealth x -> InsightHealth
$cfrom :: forall x. InsightHealth -> Rep InsightHealth x
Prelude.Generic)

-- |
-- Create a value of 'InsightHealth' 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:
--
-- 'meanTimeToRecoverInMilliseconds', 'insightHealth_meanTimeToRecoverInMilliseconds' - The Meant Time to Recover (MTTR) for the insight.
--
-- 'openReactiveInsights', 'insightHealth_openReactiveInsights' - The number of open reactive insights.
--
-- 'openProactiveInsights', 'insightHealth_openProactiveInsights' - The number of open proactive insights.
newInsightHealth ::
  InsightHealth
newInsightHealth :: InsightHealth
newInsightHealth =
  InsightHealth' :: Maybe Integer -> Maybe Int -> Maybe Int -> InsightHealth
InsightHealth'
    { $sel:meanTimeToRecoverInMilliseconds:InsightHealth' :: Maybe Integer
meanTimeToRecoverInMilliseconds =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:openReactiveInsights:InsightHealth' :: Maybe Int
openReactiveInsights = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:openProactiveInsights:InsightHealth' :: Maybe Int
openProactiveInsights = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The Meant Time to Recover (MTTR) for the insight.
insightHealth_meanTimeToRecoverInMilliseconds :: Lens.Lens' InsightHealth (Prelude.Maybe Prelude.Integer)
insightHealth_meanTimeToRecoverInMilliseconds :: (Maybe Integer -> f (Maybe Integer))
-> InsightHealth -> f InsightHealth
insightHealth_meanTimeToRecoverInMilliseconds = (InsightHealth -> Maybe Integer)
-> (InsightHealth -> Maybe Integer -> InsightHealth)
-> Lens InsightHealth InsightHealth (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightHealth' {Maybe Integer
meanTimeToRecoverInMilliseconds :: Maybe Integer
$sel:meanTimeToRecoverInMilliseconds:InsightHealth' :: InsightHealth -> Maybe Integer
meanTimeToRecoverInMilliseconds} -> Maybe Integer
meanTimeToRecoverInMilliseconds) (\s :: InsightHealth
s@InsightHealth' {} Maybe Integer
a -> InsightHealth
s {$sel:meanTimeToRecoverInMilliseconds:InsightHealth' :: Maybe Integer
meanTimeToRecoverInMilliseconds = Maybe Integer
a} :: InsightHealth)

-- | The number of open reactive insights.
insightHealth_openReactiveInsights :: Lens.Lens' InsightHealth (Prelude.Maybe Prelude.Int)
insightHealth_openReactiveInsights :: (Maybe Int -> f (Maybe Int)) -> InsightHealth -> f InsightHealth
insightHealth_openReactiveInsights = (InsightHealth -> Maybe Int)
-> (InsightHealth -> Maybe Int -> InsightHealth)
-> Lens InsightHealth InsightHealth (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightHealth' {Maybe Int
openReactiveInsights :: Maybe Int
$sel:openReactiveInsights:InsightHealth' :: InsightHealth -> Maybe Int
openReactiveInsights} -> Maybe Int
openReactiveInsights) (\s :: InsightHealth
s@InsightHealth' {} Maybe Int
a -> InsightHealth
s {$sel:openReactiveInsights:InsightHealth' :: Maybe Int
openReactiveInsights = Maybe Int
a} :: InsightHealth)

-- | The number of open proactive insights.
insightHealth_openProactiveInsights :: Lens.Lens' InsightHealth (Prelude.Maybe Prelude.Int)
insightHealth_openProactiveInsights :: (Maybe Int -> f (Maybe Int)) -> InsightHealth -> f InsightHealth
insightHealth_openProactiveInsights = (InsightHealth -> Maybe Int)
-> (InsightHealth -> Maybe Int -> InsightHealth)
-> Lens InsightHealth InsightHealth (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightHealth' {Maybe Int
openProactiveInsights :: Maybe Int
$sel:openProactiveInsights:InsightHealth' :: InsightHealth -> Maybe Int
openProactiveInsights} -> Maybe Int
openProactiveInsights) (\s :: InsightHealth
s@InsightHealth' {} Maybe Int
a -> InsightHealth
s {$sel:openProactiveInsights:InsightHealth' :: Maybe Int
openProactiveInsights = Maybe Int
a} :: InsightHealth)

instance Core.FromJSON InsightHealth where
  parseJSON :: Value -> Parser InsightHealth
parseJSON =
    String
-> (Object -> Parser InsightHealth)
-> Value
-> Parser InsightHealth
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InsightHealth"
      ( \Object
x ->
          Maybe Integer -> Maybe Int -> Maybe Int -> InsightHealth
InsightHealth'
            (Maybe Integer -> Maybe Int -> Maybe Int -> InsightHealth)
-> Parser (Maybe Integer)
-> Parser (Maybe Int -> Maybe Int -> InsightHealth)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MeanTimeToRecoverInMilliseconds")
            Parser (Maybe Int -> Maybe Int -> InsightHealth)
-> Parser (Maybe Int) -> Parser (Maybe Int -> InsightHealth)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OpenReactiveInsights")
            Parser (Maybe Int -> InsightHealth)
-> Parser (Maybe Int) -> Parser InsightHealth
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OpenProactiveInsights")
      )

instance Prelude.Hashable InsightHealth

instance Prelude.NFData InsightHealth