{-# 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.ForecastQuery.Types.Forecast
-- 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.ForecastQuery.Types.Forecast where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ForecastQuery.Types.DataPoint
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a forecast. Returned as part of the
-- QueryForecast response.
--
-- /See:/ 'newForecast' smart constructor.
data Forecast = Forecast'
  { -- | The forecast.
    --
    -- The /string/ of the string-to-array map is one of the following values:
    --
    -- -   p10
    --
    -- -   p50
    --
    -- -   p90
    --
    -- The default setting is @[\"0.1\", \"0.5\", \"0.9\"]@. Use the optional
    -- @ForecastTypes@ parameter of the
    -- <https://docs.aws.amazon.com/forecast/latest/dg/API_CreateForecast.html CreateForecast>
    -- operation to change the values. The values will vary depending on how
    -- this is set, with a minimum of @1@ and a maximum of @5.@
    Forecast -> Maybe (HashMap Text [DataPoint])
predictions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [DataPoint])
  }
  deriving (Forecast -> Forecast -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Forecast -> Forecast -> Bool
$c/= :: Forecast -> Forecast -> Bool
== :: Forecast -> Forecast -> Bool
$c== :: Forecast -> Forecast -> Bool
Prelude.Eq, ReadPrec [Forecast]
ReadPrec Forecast
Int -> ReadS Forecast
ReadS [Forecast]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Forecast]
$creadListPrec :: ReadPrec [Forecast]
readPrec :: ReadPrec Forecast
$creadPrec :: ReadPrec Forecast
readList :: ReadS [Forecast]
$creadList :: ReadS [Forecast]
readsPrec :: Int -> ReadS Forecast
$creadsPrec :: Int -> ReadS Forecast
Prelude.Read, Int -> Forecast -> ShowS
[Forecast] -> ShowS
Forecast -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Forecast] -> ShowS
$cshowList :: [Forecast] -> ShowS
show :: Forecast -> String
$cshow :: Forecast -> String
showsPrec :: Int -> Forecast -> ShowS
$cshowsPrec :: Int -> Forecast -> ShowS
Prelude.Show, forall x. Rep Forecast x -> Forecast
forall x. Forecast -> Rep Forecast x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Forecast x -> Forecast
$cfrom :: forall x. Forecast -> Rep Forecast x
Prelude.Generic)

-- |
-- Create a value of 'Forecast' 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:
--
-- 'predictions', 'forecast_predictions' - The forecast.
--
-- The /string/ of the string-to-array map is one of the following values:
--
-- -   p10
--
-- -   p50
--
-- -   p90
--
-- The default setting is @[\"0.1\", \"0.5\", \"0.9\"]@. Use the optional
-- @ForecastTypes@ parameter of the
-- <https://docs.aws.amazon.com/forecast/latest/dg/API_CreateForecast.html CreateForecast>
-- operation to change the values. The values will vary depending on how
-- this is set, with a minimum of @1@ and a maximum of @5.@
newForecast ::
  Forecast
newForecast :: Forecast
newForecast =
  Forecast' {$sel:predictions:Forecast' :: Maybe (HashMap Text [DataPoint])
predictions = forall a. Maybe a
Prelude.Nothing}

-- | The forecast.
--
-- The /string/ of the string-to-array map is one of the following values:
--
-- -   p10
--
-- -   p50
--
-- -   p90
--
-- The default setting is @[\"0.1\", \"0.5\", \"0.9\"]@. Use the optional
-- @ForecastTypes@ parameter of the
-- <https://docs.aws.amazon.com/forecast/latest/dg/API_CreateForecast.html CreateForecast>
-- operation to change the values. The values will vary depending on how
-- this is set, with a minimum of @1@ and a maximum of @5.@
forecast_predictions :: Lens.Lens' Forecast (Prelude.Maybe (Prelude.HashMap Prelude.Text [DataPoint]))
forecast_predictions :: Lens' Forecast (Maybe (HashMap Text [DataPoint]))
forecast_predictions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Forecast' {Maybe (HashMap Text [DataPoint])
predictions :: Maybe (HashMap Text [DataPoint])
$sel:predictions:Forecast' :: Forecast -> Maybe (HashMap Text [DataPoint])
predictions} -> Maybe (HashMap Text [DataPoint])
predictions) (\s :: Forecast
s@Forecast' {} Maybe (HashMap Text [DataPoint])
a -> Forecast
s {$sel:predictions:Forecast' :: Maybe (HashMap Text [DataPoint])
predictions = Maybe (HashMap Text [DataPoint])
a} :: Forecast) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Forecast where
  parseJSON :: Value -> Parser Forecast
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Forecast"
      ( \Object
x ->
          Maybe (HashMap Text [DataPoint]) -> Forecast
Forecast'
            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
"Predictions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Forecast where
  hashWithSalt :: Int -> Forecast -> Int
hashWithSalt Int
_salt Forecast' {Maybe (HashMap Text [DataPoint])
predictions :: Maybe (HashMap Text [DataPoint])
$sel:predictions:Forecast' :: Forecast -> Maybe (HashMap Text [DataPoint])
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text [DataPoint])
predictions

instance Prelude.NFData Forecast where
  rnf :: Forecast -> ()
rnf Forecast' {Maybe (HashMap Text [DataPoint])
predictions :: Maybe (HashMap Text [DataPoint])
$sel:predictions:Forecast' :: Forecast -> Maybe (HashMap Text [DataPoint])
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text [DataPoint])
predictions