{-# 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.QuickSight.Types.ForecastConfiguration
-- 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.QuickSight.Types.ForecastConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.ForecastScenario
import Amazonka.QuickSight.Types.TimeBasedForecastProperties

-- | The forecast configuration that is used in a line chart\'s display
-- properties.
--
-- /See:/ 'newForecastConfiguration' smart constructor.
data ForecastConfiguration = ForecastConfiguration'
  { -- | The forecast properties setup of a forecast in the line chart.
    ForecastConfiguration -> Maybe TimeBasedForecastProperties
forecastProperties :: Prelude.Maybe TimeBasedForecastProperties,
    -- | The forecast scenario of a forecast in the line chart.
    ForecastConfiguration -> Maybe ForecastScenario
scenario :: Prelude.Maybe ForecastScenario
  }
  deriving (ForecastConfiguration -> ForecastConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForecastConfiguration -> ForecastConfiguration -> Bool
$c/= :: ForecastConfiguration -> ForecastConfiguration -> Bool
== :: ForecastConfiguration -> ForecastConfiguration -> Bool
$c== :: ForecastConfiguration -> ForecastConfiguration -> Bool
Prelude.Eq, ReadPrec [ForecastConfiguration]
ReadPrec ForecastConfiguration
Int -> ReadS ForecastConfiguration
ReadS [ForecastConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForecastConfiguration]
$creadListPrec :: ReadPrec [ForecastConfiguration]
readPrec :: ReadPrec ForecastConfiguration
$creadPrec :: ReadPrec ForecastConfiguration
readList :: ReadS [ForecastConfiguration]
$creadList :: ReadS [ForecastConfiguration]
readsPrec :: Int -> ReadS ForecastConfiguration
$creadsPrec :: Int -> ReadS ForecastConfiguration
Prelude.Read, Int -> ForecastConfiguration -> ShowS
[ForecastConfiguration] -> ShowS
ForecastConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForecastConfiguration] -> ShowS
$cshowList :: [ForecastConfiguration] -> ShowS
show :: ForecastConfiguration -> String
$cshow :: ForecastConfiguration -> String
showsPrec :: Int -> ForecastConfiguration -> ShowS
$cshowsPrec :: Int -> ForecastConfiguration -> ShowS
Prelude.Show, forall x. Rep ForecastConfiguration x -> ForecastConfiguration
forall x. ForecastConfiguration -> Rep ForecastConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForecastConfiguration x -> ForecastConfiguration
$cfrom :: forall x. ForecastConfiguration -> Rep ForecastConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ForecastConfiguration' 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:
--
-- 'forecastProperties', 'forecastConfiguration_forecastProperties' - The forecast properties setup of a forecast in the line chart.
--
-- 'scenario', 'forecastConfiguration_scenario' - The forecast scenario of a forecast in the line chart.
newForecastConfiguration ::
  ForecastConfiguration
newForecastConfiguration :: ForecastConfiguration
newForecastConfiguration =
  ForecastConfiguration'
    { $sel:forecastProperties:ForecastConfiguration' :: Maybe TimeBasedForecastProperties
forecastProperties =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scenario:ForecastConfiguration' :: Maybe ForecastScenario
scenario = forall a. Maybe a
Prelude.Nothing
    }

-- | The forecast properties setup of a forecast in the line chart.
forecastConfiguration_forecastProperties :: Lens.Lens' ForecastConfiguration (Prelude.Maybe TimeBasedForecastProperties)
forecastConfiguration_forecastProperties :: Lens' ForecastConfiguration (Maybe TimeBasedForecastProperties)
forecastConfiguration_forecastProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastConfiguration' {Maybe TimeBasedForecastProperties
forecastProperties :: Maybe TimeBasedForecastProperties
$sel:forecastProperties:ForecastConfiguration' :: ForecastConfiguration -> Maybe TimeBasedForecastProperties
forecastProperties} -> Maybe TimeBasedForecastProperties
forecastProperties) (\s :: ForecastConfiguration
s@ForecastConfiguration' {} Maybe TimeBasedForecastProperties
a -> ForecastConfiguration
s {$sel:forecastProperties:ForecastConfiguration' :: Maybe TimeBasedForecastProperties
forecastProperties = Maybe TimeBasedForecastProperties
a} :: ForecastConfiguration)

-- | The forecast scenario of a forecast in the line chart.
forecastConfiguration_scenario :: Lens.Lens' ForecastConfiguration (Prelude.Maybe ForecastScenario)
forecastConfiguration_scenario :: Lens' ForecastConfiguration (Maybe ForecastScenario)
forecastConfiguration_scenario = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForecastConfiguration' {Maybe ForecastScenario
scenario :: Maybe ForecastScenario
$sel:scenario:ForecastConfiguration' :: ForecastConfiguration -> Maybe ForecastScenario
scenario} -> Maybe ForecastScenario
scenario) (\s :: ForecastConfiguration
s@ForecastConfiguration' {} Maybe ForecastScenario
a -> ForecastConfiguration
s {$sel:scenario:ForecastConfiguration' :: Maybe ForecastScenario
scenario = Maybe ForecastScenario
a} :: ForecastConfiguration)

instance Data.FromJSON ForecastConfiguration where
  parseJSON :: Value -> Parser ForecastConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ForecastConfiguration"
      ( \Object
x ->
          Maybe TimeBasedForecastProperties
-> Maybe ForecastScenario -> ForecastConfiguration
ForecastConfiguration'
            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
"ForecastProperties")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Scenario")
      )

instance Prelude.Hashable ForecastConfiguration where
  hashWithSalt :: Int -> ForecastConfiguration -> Int
hashWithSalt Int
_salt ForecastConfiguration' {Maybe TimeBasedForecastProperties
Maybe ForecastScenario
scenario :: Maybe ForecastScenario
forecastProperties :: Maybe TimeBasedForecastProperties
$sel:scenario:ForecastConfiguration' :: ForecastConfiguration -> Maybe ForecastScenario
$sel:forecastProperties:ForecastConfiguration' :: ForecastConfiguration -> Maybe TimeBasedForecastProperties
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeBasedForecastProperties
forecastProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ForecastScenario
scenario

instance Prelude.NFData ForecastConfiguration where
  rnf :: ForecastConfiguration -> ()
rnf ForecastConfiguration' {Maybe TimeBasedForecastProperties
Maybe ForecastScenario
scenario :: Maybe ForecastScenario
forecastProperties :: Maybe TimeBasedForecastProperties
$sel:scenario:ForecastConfiguration' :: ForecastConfiguration -> Maybe ForecastScenario
$sel:forecastProperties:ForecastConfiguration' :: ForecastConfiguration -> Maybe TimeBasedForecastProperties
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeBasedForecastProperties
forecastProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ForecastScenario
scenario

instance Data.ToJSON ForecastConfiguration where
  toJSON :: ForecastConfiguration -> Value
toJSON ForecastConfiguration' {Maybe TimeBasedForecastProperties
Maybe ForecastScenario
scenario :: Maybe ForecastScenario
forecastProperties :: Maybe TimeBasedForecastProperties
$sel:scenario:ForecastConfiguration' :: ForecastConfiguration -> Maybe ForecastScenario
$sel:forecastProperties:ForecastConfiguration' :: ForecastConfiguration -> Maybe TimeBasedForecastProperties
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ForecastProperties" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimeBasedForecastProperties
forecastProperties,
            (Key
"Scenario" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ForecastScenario
scenario
          ]
      )