{-# 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 #-}
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
data Forecast = Forecast'
{
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)
newForecast ::
Forecast
newForecast :: Forecast
newForecast =
Forecast' {$sel:predictions:Forecast' :: Maybe (HashMap Text [DataPoint])
predictions = forall a. Maybe a
Prelude.Nothing}
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