{-# 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.CostExplorer.Types.ForecastResult
-- 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.CostExplorer.Types.ForecastResult where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.DateInterval
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The forecast that\'s created for your query.
--
-- /See:/ 'newForecastResult' smart constructor.
data ForecastResult = ForecastResult'
  { -- | The period of time that the forecast covers.
    ForecastResult -> Maybe DateInterval
timePeriod :: Prelude.Maybe DateInterval,
    -- | The mean value of the forecast.
    ForecastResult -> Maybe Text
meanValue :: Prelude.Maybe Prelude.Text,
    -- | The upper limit for the prediction interval.
    ForecastResult -> Maybe Text
predictionIntervalUpperBound :: Prelude.Maybe Prelude.Text,
    -- | The lower limit for the prediction interval.
    ForecastResult -> Maybe Text
predictionIntervalLowerBound :: Prelude.Maybe Prelude.Text
  }
  deriving (ForecastResult -> ForecastResult -> Bool
(ForecastResult -> ForecastResult -> Bool)
-> (ForecastResult -> ForecastResult -> Bool) -> Eq ForecastResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForecastResult -> ForecastResult -> Bool
$c/= :: ForecastResult -> ForecastResult -> Bool
== :: ForecastResult -> ForecastResult -> Bool
$c== :: ForecastResult -> ForecastResult -> Bool
Prelude.Eq, ReadPrec [ForecastResult]
ReadPrec ForecastResult
Int -> ReadS ForecastResult
ReadS [ForecastResult]
(Int -> ReadS ForecastResult)
-> ReadS [ForecastResult]
-> ReadPrec ForecastResult
-> ReadPrec [ForecastResult]
-> Read ForecastResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForecastResult]
$creadListPrec :: ReadPrec [ForecastResult]
readPrec :: ReadPrec ForecastResult
$creadPrec :: ReadPrec ForecastResult
readList :: ReadS [ForecastResult]
$creadList :: ReadS [ForecastResult]
readsPrec :: Int -> ReadS ForecastResult
$creadsPrec :: Int -> ReadS ForecastResult
Prelude.Read, Int -> ForecastResult -> ShowS
[ForecastResult] -> ShowS
ForecastResult -> String
(Int -> ForecastResult -> ShowS)
-> (ForecastResult -> String)
-> ([ForecastResult] -> ShowS)
-> Show ForecastResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForecastResult] -> ShowS
$cshowList :: [ForecastResult] -> ShowS
show :: ForecastResult -> String
$cshow :: ForecastResult -> String
showsPrec :: Int -> ForecastResult -> ShowS
$cshowsPrec :: Int -> ForecastResult -> ShowS
Prelude.Show, (forall x. ForecastResult -> Rep ForecastResult x)
-> (forall x. Rep ForecastResult x -> ForecastResult)
-> Generic ForecastResult
forall x. Rep ForecastResult x -> ForecastResult
forall x. ForecastResult -> Rep ForecastResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForecastResult x -> ForecastResult
$cfrom :: forall x. ForecastResult -> Rep ForecastResult x
Prelude.Generic)

-- |
-- Create a value of 'ForecastResult' 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:
--
-- 'timePeriod', 'forecastResult_timePeriod' - The period of time that the forecast covers.
--
-- 'meanValue', 'forecastResult_meanValue' - The mean value of the forecast.
--
-- 'predictionIntervalUpperBound', 'forecastResult_predictionIntervalUpperBound' - The upper limit for the prediction interval.
--
-- 'predictionIntervalLowerBound', 'forecastResult_predictionIntervalLowerBound' - The lower limit for the prediction interval.
newForecastResult ::
  ForecastResult
newForecastResult :: ForecastResult
newForecastResult =
  ForecastResult' :: Maybe DateInterval
-> Maybe Text -> Maybe Text -> Maybe Text -> ForecastResult
ForecastResult'
    { $sel:timePeriod:ForecastResult' :: Maybe DateInterval
timePeriod = Maybe DateInterval
forall a. Maybe a
Prelude.Nothing,
      $sel:meanValue:ForecastResult' :: Maybe Text
meanValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:predictionIntervalUpperBound:ForecastResult' :: Maybe Text
predictionIntervalUpperBound = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:predictionIntervalLowerBound:ForecastResult' :: Maybe Text
predictionIntervalLowerBound = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The period of time that the forecast covers.
forecastResult_timePeriod :: Lens.Lens' ForecastResult (Prelude.Maybe DateInterval)
forecastResult_timePeriod :: (Maybe DateInterval -> f (Maybe DateInterval))
-> ForecastResult -> f ForecastResult
forecastResult_timePeriod = (ForecastResult -> Maybe DateInterval)
-> (ForecastResult -> Maybe DateInterval -> ForecastResult)
-> Lens
     ForecastResult
     ForecastResult
     (Maybe DateInterval)
     (Maybe DateInterval)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastResult' {Maybe DateInterval
timePeriod :: Maybe DateInterval
$sel:timePeriod:ForecastResult' :: ForecastResult -> Maybe DateInterval
timePeriod} -> Maybe DateInterval
timePeriod) (\s :: ForecastResult
s@ForecastResult' {} Maybe DateInterval
a -> ForecastResult
s {$sel:timePeriod:ForecastResult' :: Maybe DateInterval
timePeriod = Maybe DateInterval
a} :: ForecastResult)

-- | The mean value of the forecast.
forecastResult_meanValue :: Lens.Lens' ForecastResult (Prelude.Maybe Prelude.Text)
forecastResult_meanValue :: (Maybe Text -> f (Maybe Text))
-> ForecastResult -> f ForecastResult
forecastResult_meanValue = (ForecastResult -> Maybe Text)
-> (ForecastResult -> Maybe Text -> ForecastResult)
-> Lens ForecastResult ForecastResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastResult' {Maybe Text
meanValue :: Maybe Text
$sel:meanValue:ForecastResult' :: ForecastResult -> Maybe Text
meanValue} -> Maybe Text
meanValue) (\s :: ForecastResult
s@ForecastResult' {} Maybe Text
a -> ForecastResult
s {$sel:meanValue:ForecastResult' :: Maybe Text
meanValue = Maybe Text
a} :: ForecastResult)

-- | The upper limit for the prediction interval.
forecastResult_predictionIntervalUpperBound :: Lens.Lens' ForecastResult (Prelude.Maybe Prelude.Text)
forecastResult_predictionIntervalUpperBound :: (Maybe Text -> f (Maybe Text))
-> ForecastResult -> f ForecastResult
forecastResult_predictionIntervalUpperBound = (ForecastResult -> Maybe Text)
-> (ForecastResult -> Maybe Text -> ForecastResult)
-> Lens ForecastResult ForecastResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastResult' {Maybe Text
predictionIntervalUpperBound :: Maybe Text
$sel:predictionIntervalUpperBound:ForecastResult' :: ForecastResult -> Maybe Text
predictionIntervalUpperBound} -> Maybe Text
predictionIntervalUpperBound) (\s :: ForecastResult
s@ForecastResult' {} Maybe Text
a -> ForecastResult
s {$sel:predictionIntervalUpperBound:ForecastResult' :: Maybe Text
predictionIntervalUpperBound = Maybe Text
a} :: ForecastResult)

-- | The lower limit for the prediction interval.
forecastResult_predictionIntervalLowerBound :: Lens.Lens' ForecastResult (Prelude.Maybe Prelude.Text)
forecastResult_predictionIntervalLowerBound :: (Maybe Text -> f (Maybe Text))
-> ForecastResult -> f ForecastResult
forecastResult_predictionIntervalLowerBound = (ForecastResult -> Maybe Text)
-> (ForecastResult -> Maybe Text -> ForecastResult)
-> Lens ForecastResult ForecastResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastResult' {Maybe Text
predictionIntervalLowerBound :: Maybe Text
$sel:predictionIntervalLowerBound:ForecastResult' :: ForecastResult -> Maybe Text
predictionIntervalLowerBound} -> Maybe Text
predictionIntervalLowerBound) (\s :: ForecastResult
s@ForecastResult' {} Maybe Text
a -> ForecastResult
s {$sel:predictionIntervalLowerBound:ForecastResult' :: Maybe Text
predictionIntervalLowerBound = Maybe Text
a} :: ForecastResult)

instance Core.FromJSON ForecastResult where
  parseJSON :: Value -> Parser ForecastResult
parseJSON =
    String
-> (Object -> Parser ForecastResult)
-> Value
-> Parser ForecastResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ForecastResult"
      ( \Object
x ->
          Maybe DateInterval
-> Maybe Text -> Maybe Text -> Maybe Text -> ForecastResult
ForecastResult'
            (Maybe DateInterval
 -> Maybe Text -> Maybe Text -> Maybe Text -> ForecastResult)
-> Parser (Maybe DateInterval)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ForecastResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DateInterval)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimePeriod")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ForecastResult)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ForecastResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MeanValue")
            Parser (Maybe Text -> Maybe Text -> ForecastResult)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ForecastResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictionIntervalUpperBound")
            Parser (Maybe Text -> ForecastResult)
-> Parser (Maybe Text) -> Parser ForecastResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictionIntervalLowerBound")
      )

instance Prelude.Hashable ForecastResult

instance Prelude.NFData ForecastResult