{-# 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.XRay.Types.ForecastStatistics
-- 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.XRay.Types.ForecastStatistics where

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

-- | The predicted high and low fault count. This is used to determine if a
-- service has become anomalous and if an insight should be created.
--
-- /See:/ 'newForecastStatistics' smart constructor.
data ForecastStatistics = ForecastStatistics'
  { -- | The lower limit of fault counts for a service.
    ForecastStatistics -> Maybe Integer
faultCountLow :: Prelude.Maybe Prelude.Integer,
    -- | The upper limit of fault counts for a service.
    ForecastStatistics -> Maybe Integer
faultCountHigh :: Prelude.Maybe Prelude.Integer
  }
  deriving (ForecastStatistics -> ForecastStatistics -> Bool
(ForecastStatistics -> ForecastStatistics -> Bool)
-> (ForecastStatistics -> ForecastStatistics -> Bool)
-> Eq ForecastStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForecastStatistics -> ForecastStatistics -> Bool
$c/= :: ForecastStatistics -> ForecastStatistics -> Bool
== :: ForecastStatistics -> ForecastStatistics -> Bool
$c== :: ForecastStatistics -> ForecastStatistics -> Bool
Prelude.Eq, ReadPrec [ForecastStatistics]
ReadPrec ForecastStatistics
Int -> ReadS ForecastStatistics
ReadS [ForecastStatistics]
(Int -> ReadS ForecastStatistics)
-> ReadS [ForecastStatistics]
-> ReadPrec ForecastStatistics
-> ReadPrec [ForecastStatistics]
-> Read ForecastStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForecastStatistics]
$creadListPrec :: ReadPrec [ForecastStatistics]
readPrec :: ReadPrec ForecastStatistics
$creadPrec :: ReadPrec ForecastStatistics
readList :: ReadS [ForecastStatistics]
$creadList :: ReadS [ForecastStatistics]
readsPrec :: Int -> ReadS ForecastStatistics
$creadsPrec :: Int -> ReadS ForecastStatistics
Prelude.Read, Int -> ForecastStatistics -> ShowS
[ForecastStatistics] -> ShowS
ForecastStatistics -> String
(Int -> ForecastStatistics -> ShowS)
-> (ForecastStatistics -> String)
-> ([ForecastStatistics] -> ShowS)
-> Show ForecastStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForecastStatistics] -> ShowS
$cshowList :: [ForecastStatistics] -> ShowS
show :: ForecastStatistics -> String
$cshow :: ForecastStatistics -> String
showsPrec :: Int -> ForecastStatistics -> ShowS
$cshowsPrec :: Int -> ForecastStatistics -> ShowS
Prelude.Show, (forall x. ForecastStatistics -> Rep ForecastStatistics x)
-> (forall x. Rep ForecastStatistics x -> ForecastStatistics)
-> Generic ForecastStatistics
forall x. Rep ForecastStatistics x -> ForecastStatistics
forall x. ForecastStatistics -> Rep ForecastStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForecastStatistics x -> ForecastStatistics
$cfrom :: forall x. ForecastStatistics -> Rep ForecastStatistics x
Prelude.Generic)

-- |
-- Create a value of 'ForecastStatistics' 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:
--
-- 'faultCountLow', 'forecastStatistics_faultCountLow' - The lower limit of fault counts for a service.
--
-- 'faultCountHigh', 'forecastStatistics_faultCountHigh' - The upper limit of fault counts for a service.
newForecastStatistics ::
  ForecastStatistics
newForecastStatistics :: ForecastStatistics
newForecastStatistics =
  ForecastStatistics' :: Maybe Integer -> Maybe Integer -> ForecastStatistics
ForecastStatistics'
    { $sel:faultCountLow:ForecastStatistics' :: Maybe Integer
faultCountLow =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:faultCountHigh:ForecastStatistics' :: Maybe Integer
faultCountHigh = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The lower limit of fault counts for a service.
forecastStatistics_faultCountLow :: Lens.Lens' ForecastStatistics (Prelude.Maybe Prelude.Integer)
forecastStatistics_faultCountLow :: (Maybe Integer -> f (Maybe Integer))
-> ForecastStatistics -> f ForecastStatistics
forecastStatistics_faultCountLow = (ForecastStatistics -> Maybe Integer)
-> (ForecastStatistics -> Maybe Integer -> ForecastStatistics)
-> Lens
     ForecastStatistics
     ForecastStatistics
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastStatistics' {Maybe Integer
faultCountLow :: Maybe Integer
$sel:faultCountLow:ForecastStatistics' :: ForecastStatistics -> Maybe Integer
faultCountLow} -> Maybe Integer
faultCountLow) (\s :: ForecastStatistics
s@ForecastStatistics' {} Maybe Integer
a -> ForecastStatistics
s {$sel:faultCountLow:ForecastStatistics' :: Maybe Integer
faultCountLow = Maybe Integer
a} :: ForecastStatistics)

-- | The upper limit of fault counts for a service.
forecastStatistics_faultCountHigh :: Lens.Lens' ForecastStatistics (Prelude.Maybe Prelude.Integer)
forecastStatistics_faultCountHigh :: (Maybe Integer -> f (Maybe Integer))
-> ForecastStatistics -> f ForecastStatistics
forecastStatistics_faultCountHigh = (ForecastStatistics -> Maybe Integer)
-> (ForecastStatistics -> Maybe Integer -> ForecastStatistics)
-> Lens
     ForecastStatistics
     ForecastStatistics
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastStatistics' {Maybe Integer
faultCountHigh :: Maybe Integer
$sel:faultCountHigh:ForecastStatistics' :: ForecastStatistics -> Maybe Integer
faultCountHigh} -> Maybe Integer
faultCountHigh) (\s :: ForecastStatistics
s@ForecastStatistics' {} Maybe Integer
a -> ForecastStatistics
s {$sel:faultCountHigh:ForecastStatistics' :: Maybe Integer
faultCountHigh = Maybe Integer
a} :: ForecastStatistics)

instance Core.FromJSON ForecastStatistics where
  parseJSON :: Value -> Parser ForecastStatistics
parseJSON =
    String
-> (Object -> Parser ForecastStatistics)
-> Value
-> Parser ForecastStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ForecastStatistics"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> ForecastStatistics
ForecastStatistics'
            (Maybe Integer -> Maybe Integer -> ForecastStatistics)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> ForecastStatistics)
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
"FaultCountLow")
            Parser (Maybe Integer -> ForecastStatistics)
-> Parser (Maybe Integer) -> Parser ForecastStatistics
forall (f :: * -> *) a b. Applicative f => 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
"FaultCountHigh")
      )

instance Prelude.Hashable ForecastStatistics

instance Prelude.NFData ForecastStatistics