{-# 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.Computation
-- 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.Computation 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.ForecastComputation
import Amazonka.QuickSight.Types.GrowthRateComputation
import Amazonka.QuickSight.Types.MaximumMinimumComputation
import Amazonka.QuickSight.Types.MetricComparisonComputation
import Amazonka.QuickSight.Types.PeriodOverPeriodComputation
import Amazonka.QuickSight.Types.PeriodToDateComputation
import Amazonka.QuickSight.Types.TopBottomMoversComputation
import Amazonka.QuickSight.Types.TopBottomRankedComputation
import Amazonka.QuickSight.Types.TotalAggregationComputation
import Amazonka.QuickSight.Types.UniqueValuesComputation

-- | The computation union that is used in an insight visual.
--
-- This is a union type structure. For this structure to be valid, only one
-- of the attributes can be defined.
--
-- /See:/ 'newComputation' smart constructor.
data Computation = Computation'
  { -- | The forecast computation configuration.
    Computation -> Maybe ForecastComputation
forecast :: Prelude.Maybe ForecastComputation,
    -- | The growth rate computation configuration.
    Computation -> Maybe GrowthRateComputation
growthRate :: Prelude.Maybe GrowthRateComputation,
    -- | The maximum and minimum computation configuration.
    Computation -> Maybe MaximumMinimumComputation
maximumMinimum :: Prelude.Maybe MaximumMinimumComputation,
    -- | The metric comparison computation configuration.
    Computation -> Maybe MetricComparisonComputation
metricComparison :: Prelude.Maybe MetricComparisonComputation,
    -- | The period over period computation configuration.
    Computation -> Maybe PeriodOverPeriodComputation
periodOverPeriod :: Prelude.Maybe PeriodOverPeriodComputation,
    -- | The period to @DataSetIdentifier@ computation configuration.
    Computation -> Maybe PeriodToDateComputation
periodToDate :: Prelude.Maybe PeriodToDateComputation,
    -- | The top movers and bottom movers computation configuration.
    Computation -> Maybe TopBottomMoversComputation
topBottomMovers :: Prelude.Maybe TopBottomMoversComputation,
    -- | The top ranked and bottom ranked computation configuration.
    Computation -> Maybe TopBottomRankedComputation
topBottomRanked :: Prelude.Maybe TopBottomRankedComputation,
    -- | The total aggregation computation configuration.
    Computation -> Maybe TotalAggregationComputation
totalAggregation :: Prelude.Maybe TotalAggregationComputation,
    -- | The unique values computation configuration.
    Computation -> Maybe UniqueValuesComputation
uniqueValues :: Prelude.Maybe UniqueValuesComputation
  }
  deriving (Computation -> Computation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Computation -> Computation -> Bool
$c/= :: Computation -> Computation -> Bool
== :: Computation -> Computation -> Bool
$c== :: Computation -> Computation -> Bool
Prelude.Eq, Int -> Computation -> ShowS
[Computation] -> ShowS
Computation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Computation] -> ShowS
$cshowList :: [Computation] -> ShowS
show :: Computation -> String
$cshow :: Computation -> String
showsPrec :: Int -> Computation -> ShowS
$cshowsPrec :: Int -> Computation -> ShowS
Prelude.Show, forall x. Rep Computation x -> Computation
forall x. Computation -> Rep Computation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Computation x -> Computation
$cfrom :: forall x. Computation -> Rep Computation x
Prelude.Generic)

-- |
-- Create a value of 'Computation' 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:
--
-- 'forecast', 'computation_forecast' - The forecast computation configuration.
--
-- 'growthRate', 'computation_growthRate' - The growth rate computation configuration.
--
-- 'maximumMinimum', 'computation_maximumMinimum' - The maximum and minimum computation configuration.
--
-- 'metricComparison', 'computation_metricComparison' - The metric comparison computation configuration.
--
-- 'periodOverPeriod', 'computation_periodOverPeriod' - The period over period computation configuration.
--
-- 'periodToDate', 'computation_periodToDate' - The period to @DataSetIdentifier@ computation configuration.
--
-- 'topBottomMovers', 'computation_topBottomMovers' - The top movers and bottom movers computation configuration.
--
-- 'topBottomRanked', 'computation_topBottomRanked' - The top ranked and bottom ranked computation configuration.
--
-- 'totalAggregation', 'computation_totalAggregation' - The total aggregation computation configuration.
--
-- 'uniqueValues', 'computation_uniqueValues' - The unique values computation configuration.
newComputation ::
  Computation
newComputation :: Computation
newComputation =
  Computation'
    { $sel:forecast:Computation' :: Maybe ForecastComputation
forecast = forall a. Maybe a
Prelude.Nothing,
      $sel:growthRate:Computation' :: Maybe GrowthRateComputation
growthRate = forall a. Maybe a
Prelude.Nothing,
      $sel:maximumMinimum:Computation' :: Maybe MaximumMinimumComputation
maximumMinimum = forall a. Maybe a
Prelude.Nothing,
      $sel:metricComparison:Computation' :: Maybe MetricComparisonComputation
metricComparison = forall a. Maybe a
Prelude.Nothing,
      $sel:periodOverPeriod:Computation' :: Maybe PeriodOverPeriodComputation
periodOverPeriod = forall a. Maybe a
Prelude.Nothing,
      $sel:periodToDate:Computation' :: Maybe PeriodToDateComputation
periodToDate = forall a. Maybe a
Prelude.Nothing,
      $sel:topBottomMovers:Computation' :: Maybe TopBottomMoversComputation
topBottomMovers = forall a. Maybe a
Prelude.Nothing,
      $sel:topBottomRanked:Computation' :: Maybe TopBottomRankedComputation
topBottomRanked = forall a. Maybe a
Prelude.Nothing,
      $sel:totalAggregation:Computation' :: Maybe TotalAggregationComputation
totalAggregation = forall a. Maybe a
Prelude.Nothing,
      $sel:uniqueValues:Computation' :: Maybe UniqueValuesComputation
uniqueValues = forall a. Maybe a
Prelude.Nothing
    }

-- | The forecast computation configuration.
computation_forecast :: Lens.Lens' Computation (Prelude.Maybe ForecastComputation)
computation_forecast :: Lens' Computation (Maybe ForecastComputation)
computation_forecast = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe ForecastComputation
forecast :: Maybe ForecastComputation
$sel:forecast:Computation' :: Computation -> Maybe ForecastComputation
forecast} -> Maybe ForecastComputation
forecast) (\s :: Computation
s@Computation' {} Maybe ForecastComputation
a -> Computation
s {$sel:forecast:Computation' :: Maybe ForecastComputation
forecast = Maybe ForecastComputation
a} :: Computation)

-- | The growth rate computation configuration.
computation_growthRate :: Lens.Lens' Computation (Prelude.Maybe GrowthRateComputation)
computation_growthRate :: Lens' Computation (Maybe GrowthRateComputation)
computation_growthRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe GrowthRateComputation
growthRate :: Maybe GrowthRateComputation
$sel:growthRate:Computation' :: Computation -> Maybe GrowthRateComputation
growthRate} -> Maybe GrowthRateComputation
growthRate) (\s :: Computation
s@Computation' {} Maybe GrowthRateComputation
a -> Computation
s {$sel:growthRate:Computation' :: Maybe GrowthRateComputation
growthRate = Maybe GrowthRateComputation
a} :: Computation)

-- | The maximum and minimum computation configuration.
computation_maximumMinimum :: Lens.Lens' Computation (Prelude.Maybe MaximumMinimumComputation)
computation_maximumMinimum :: Lens' Computation (Maybe MaximumMinimumComputation)
computation_maximumMinimum = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe MaximumMinimumComputation
maximumMinimum :: Maybe MaximumMinimumComputation
$sel:maximumMinimum:Computation' :: Computation -> Maybe MaximumMinimumComputation
maximumMinimum} -> Maybe MaximumMinimumComputation
maximumMinimum) (\s :: Computation
s@Computation' {} Maybe MaximumMinimumComputation
a -> Computation
s {$sel:maximumMinimum:Computation' :: Maybe MaximumMinimumComputation
maximumMinimum = Maybe MaximumMinimumComputation
a} :: Computation)

-- | The metric comparison computation configuration.
computation_metricComparison :: Lens.Lens' Computation (Prelude.Maybe MetricComparisonComputation)
computation_metricComparison :: Lens' Computation (Maybe MetricComparisonComputation)
computation_metricComparison = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe MetricComparisonComputation
metricComparison :: Maybe MetricComparisonComputation
$sel:metricComparison:Computation' :: Computation -> Maybe MetricComparisonComputation
metricComparison} -> Maybe MetricComparisonComputation
metricComparison) (\s :: Computation
s@Computation' {} Maybe MetricComparisonComputation
a -> Computation
s {$sel:metricComparison:Computation' :: Maybe MetricComparisonComputation
metricComparison = Maybe MetricComparisonComputation
a} :: Computation)

-- | The period over period computation configuration.
computation_periodOverPeriod :: Lens.Lens' Computation (Prelude.Maybe PeriodOverPeriodComputation)
computation_periodOverPeriod :: Lens' Computation (Maybe PeriodOverPeriodComputation)
computation_periodOverPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe PeriodOverPeriodComputation
periodOverPeriod :: Maybe PeriodOverPeriodComputation
$sel:periodOverPeriod:Computation' :: Computation -> Maybe PeriodOverPeriodComputation
periodOverPeriod} -> Maybe PeriodOverPeriodComputation
periodOverPeriod) (\s :: Computation
s@Computation' {} Maybe PeriodOverPeriodComputation
a -> Computation
s {$sel:periodOverPeriod:Computation' :: Maybe PeriodOverPeriodComputation
periodOverPeriod = Maybe PeriodOverPeriodComputation
a} :: Computation)

-- | The period to @DataSetIdentifier@ computation configuration.
computation_periodToDate :: Lens.Lens' Computation (Prelude.Maybe PeriodToDateComputation)
computation_periodToDate :: Lens' Computation (Maybe PeriodToDateComputation)
computation_periodToDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe PeriodToDateComputation
periodToDate :: Maybe PeriodToDateComputation
$sel:periodToDate:Computation' :: Computation -> Maybe PeriodToDateComputation
periodToDate} -> Maybe PeriodToDateComputation
periodToDate) (\s :: Computation
s@Computation' {} Maybe PeriodToDateComputation
a -> Computation
s {$sel:periodToDate:Computation' :: Maybe PeriodToDateComputation
periodToDate = Maybe PeriodToDateComputation
a} :: Computation)

-- | The top movers and bottom movers computation configuration.
computation_topBottomMovers :: Lens.Lens' Computation (Prelude.Maybe TopBottomMoversComputation)
computation_topBottomMovers :: Lens' Computation (Maybe TopBottomMoversComputation)
computation_topBottomMovers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe TopBottomMoversComputation
topBottomMovers :: Maybe TopBottomMoversComputation
$sel:topBottomMovers:Computation' :: Computation -> Maybe TopBottomMoversComputation
topBottomMovers} -> Maybe TopBottomMoversComputation
topBottomMovers) (\s :: Computation
s@Computation' {} Maybe TopBottomMoversComputation
a -> Computation
s {$sel:topBottomMovers:Computation' :: Maybe TopBottomMoversComputation
topBottomMovers = Maybe TopBottomMoversComputation
a} :: Computation)

-- | The top ranked and bottom ranked computation configuration.
computation_topBottomRanked :: Lens.Lens' Computation (Prelude.Maybe TopBottomRankedComputation)
computation_topBottomRanked :: Lens' Computation (Maybe TopBottomRankedComputation)
computation_topBottomRanked = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe TopBottomRankedComputation
topBottomRanked :: Maybe TopBottomRankedComputation
$sel:topBottomRanked:Computation' :: Computation -> Maybe TopBottomRankedComputation
topBottomRanked} -> Maybe TopBottomRankedComputation
topBottomRanked) (\s :: Computation
s@Computation' {} Maybe TopBottomRankedComputation
a -> Computation
s {$sel:topBottomRanked:Computation' :: Maybe TopBottomRankedComputation
topBottomRanked = Maybe TopBottomRankedComputation
a} :: Computation)

-- | The total aggregation computation configuration.
computation_totalAggregation :: Lens.Lens' Computation (Prelude.Maybe TotalAggregationComputation)
computation_totalAggregation :: Lens' Computation (Maybe TotalAggregationComputation)
computation_totalAggregation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe TotalAggregationComputation
totalAggregation :: Maybe TotalAggregationComputation
$sel:totalAggregation:Computation' :: Computation -> Maybe TotalAggregationComputation
totalAggregation} -> Maybe TotalAggregationComputation
totalAggregation) (\s :: Computation
s@Computation' {} Maybe TotalAggregationComputation
a -> Computation
s {$sel:totalAggregation:Computation' :: Maybe TotalAggregationComputation
totalAggregation = Maybe TotalAggregationComputation
a} :: Computation)

-- | The unique values computation configuration.
computation_uniqueValues :: Lens.Lens' Computation (Prelude.Maybe UniqueValuesComputation)
computation_uniqueValues :: Lens' Computation (Maybe UniqueValuesComputation)
computation_uniqueValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computation' {Maybe UniqueValuesComputation
uniqueValues :: Maybe UniqueValuesComputation
$sel:uniqueValues:Computation' :: Computation -> Maybe UniqueValuesComputation
uniqueValues} -> Maybe UniqueValuesComputation
uniqueValues) (\s :: Computation
s@Computation' {} Maybe UniqueValuesComputation
a -> Computation
s {$sel:uniqueValues:Computation' :: Maybe UniqueValuesComputation
uniqueValues = Maybe UniqueValuesComputation
a} :: Computation)

instance Data.FromJSON Computation where
  parseJSON :: Value -> Parser Computation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Computation"
      ( \Object
x ->
          Maybe ForecastComputation
-> Maybe GrowthRateComputation
-> Maybe MaximumMinimumComputation
-> Maybe MetricComparisonComputation
-> Maybe PeriodOverPeriodComputation
-> Maybe PeriodToDateComputation
-> Maybe TopBottomMoversComputation
-> Maybe TopBottomRankedComputation
-> Maybe TotalAggregationComputation
-> Maybe UniqueValuesComputation
-> Computation
Computation'
            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
"Forecast")
            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
"GrowthRate")
            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
"MaximumMinimum")
            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
"MetricComparison")
            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
"PeriodOverPeriod")
            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
"PeriodToDate")
            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
"TopBottomMovers")
            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
"TopBottomRanked")
            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
"TotalAggregation")
            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
"UniqueValues")
      )

instance Prelude.Hashable Computation where
  hashWithSalt :: Int -> Computation -> Int
hashWithSalt Int
_salt Computation' {Maybe TotalAggregationComputation
Maybe UniqueValuesComputation
Maybe TopBottomRankedComputation
Maybe TopBottomMoversComputation
Maybe PeriodToDateComputation
Maybe PeriodOverPeriodComputation
Maybe MetricComparisonComputation
Maybe MaximumMinimumComputation
Maybe GrowthRateComputation
Maybe ForecastComputation
uniqueValues :: Maybe UniqueValuesComputation
totalAggregation :: Maybe TotalAggregationComputation
topBottomRanked :: Maybe TopBottomRankedComputation
topBottomMovers :: Maybe TopBottomMoversComputation
periodToDate :: Maybe PeriodToDateComputation
periodOverPeriod :: Maybe PeriodOverPeriodComputation
metricComparison :: Maybe MetricComparisonComputation
maximumMinimum :: Maybe MaximumMinimumComputation
growthRate :: Maybe GrowthRateComputation
forecast :: Maybe ForecastComputation
$sel:uniqueValues:Computation' :: Computation -> Maybe UniqueValuesComputation
$sel:totalAggregation:Computation' :: Computation -> Maybe TotalAggregationComputation
$sel:topBottomRanked:Computation' :: Computation -> Maybe TopBottomRankedComputation
$sel:topBottomMovers:Computation' :: Computation -> Maybe TopBottomMoversComputation
$sel:periodToDate:Computation' :: Computation -> Maybe PeriodToDateComputation
$sel:periodOverPeriod:Computation' :: Computation -> Maybe PeriodOverPeriodComputation
$sel:metricComparison:Computation' :: Computation -> Maybe MetricComparisonComputation
$sel:maximumMinimum:Computation' :: Computation -> Maybe MaximumMinimumComputation
$sel:growthRate:Computation' :: Computation -> Maybe GrowthRateComputation
$sel:forecast:Computation' :: Computation -> Maybe ForecastComputation
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ForecastComputation
forecast
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GrowthRateComputation
growthRate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaximumMinimumComputation
maximumMinimum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricComparisonComputation
metricComparison
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PeriodOverPeriodComputation
periodOverPeriod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PeriodToDateComputation
periodToDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TopBottomMoversComputation
topBottomMovers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TopBottomRankedComputation
topBottomRanked
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TotalAggregationComputation
totalAggregation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UniqueValuesComputation
uniqueValues

instance Prelude.NFData Computation where
  rnf :: Computation -> ()
rnf Computation' {Maybe TotalAggregationComputation
Maybe UniqueValuesComputation
Maybe TopBottomRankedComputation
Maybe TopBottomMoversComputation
Maybe PeriodToDateComputation
Maybe PeriodOverPeriodComputation
Maybe MetricComparisonComputation
Maybe MaximumMinimumComputation
Maybe GrowthRateComputation
Maybe ForecastComputation
uniqueValues :: Maybe UniqueValuesComputation
totalAggregation :: Maybe TotalAggregationComputation
topBottomRanked :: Maybe TopBottomRankedComputation
topBottomMovers :: Maybe TopBottomMoversComputation
periodToDate :: Maybe PeriodToDateComputation
periodOverPeriod :: Maybe PeriodOverPeriodComputation
metricComparison :: Maybe MetricComparisonComputation
maximumMinimum :: Maybe MaximumMinimumComputation
growthRate :: Maybe GrowthRateComputation
forecast :: Maybe ForecastComputation
$sel:uniqueValues:Computation' :: Computation -> Maybe UniqueValuesComputation
$sel:totalAggregation:Computation' :: Computation -> Maybe TotalAggregationComputation
$sel:topBottomRanked:Computation' :: Computation -> Maybe TopBottomRankedComputation
$sel:topBottomMovers:Computation' :: Computation -> Maybe TopBottomMoversComputation
$sel:periodToDate:Computation' :: Computation -> Maybe PeriodToDateComputation
$sel:periodOverPeriod:Computation' :: Computation -> Maybe PeriodOverPeriodComputation
$sel:metricComparison:Computation' :: Computation -> Maybe MetricComparisonComputation
$sel:maximumMinimum:Computation' :: Computation -> Maybe MaximumMinimumComputation
$sel:growthRate:Computation' :: Computation -> Maybe GrowthRateComputation
$sel:forecast:Computation' :: Computation -> Maybe ForecastComputation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ForecastComputation
forecast
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GrowthRateComputation
growthRate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaximumMinimumComputation
maximumMinimum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricComparisonComputation
metricComparison
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PeriodOverPeriodComputation
periodOverPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PeriodToDateComputation
periodToDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TopBottomMoversComputation
topBottomMovers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TopBottomRankedComputation
topBottomRanked
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TotalAggregationComputation
totalAggregation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UniqueValuesComputation
uniqueValues

instance Data.ToJSON Computation where
  toJSON :: Computation -> Value
toJSON Computation' {Maybe TotalAggregationComputation
Maybe UniqueValuesComputation
Maybe TopBottomRankedComputation
Maybe TopBottomMoversComputation
Maybe PeriodToDateComputation
Maybe PeriodOverPeriodComputation
Maybe MetricComparisonComputation
Maybe MaximumMinimumComputation
Maybe GrowthRateComputation
Maybe ForecastComputation
uniqueValues :: Maybe UniqueValuesComputation
totalAggregation :: Maybe TotalAggregationComputation
topBottomRanked :: Maybe TopBottomRankedComputation
topBottomMovers :: Maybe TopBottomMoversComputation
periodToDate :: Maybe PeriodToDateComputation
periodOverPeriod :: Maybe PeriodOverPeriodComputation
metricComparison :: Maybe MetricComparisonComputation
maximumMinimum :: Maybe MaximumMinimumComputation
growthRate :: Maybe GrowthRateComputation
forecast :: Maybe ForecastComputation
$sel:uniqueValues:Computation' :: Computation -> Maybe UniqueValuesComputation
$sel:totalAggregation:Computation' :: Computation -> Maybe TotalAggregationComputation
$sel:topBottomRanked:Computation' :: Computation -> Maybe TopBottomRankedComputation
$sel:topBottomMovers:Computation' :: Computation -> Maybe TopBottomMoversComputation
$sel:periodToDate:Computation' :: Computation -> Maybe PeriodToDateComputation
$sel:periodOverPeriod:Computation' :: Computation -> Maybe PeriodOverPeriodComputation
$sel:metricComparison:Computation' :: Computation -> Maybe MetricComparisonComputation
$sel:maximumMinimum:Computation' :: Computation -> Maybe MaximumMinimumComputation
$sel:growthRate:Computation' :: Computation -> Maybe GrowthRateComputation
$sel:forecast:Computation' :: Computation -> Maybe ForecastComputation
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Forecast" 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 ForecastComputation
forecast,
            (Key
"GrowthRate" 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 GrowthRateComputation
growthRate,
            (Key
"MaximumMinimum" 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 MaximumMinimumComputation
maximumMinimum,
            (Key
"MetricComparison" 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 MetricComparisonComputation
metricComparison,
            (Key
"PeriodOverPeriod" 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 PeriodOverPeriodComputation
periodOverPeriod,
            (Key
"PeriodToDate" 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 PeriodToDateComputation
periodToDate,
            (Key
"TopBottomMovers" 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 TopBottomMoversComputation
topBottomMovers,
            (Key
"TopBottomRanked" 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 TopBottomRankedComputation
topBottomRanked,
            (Key
"TotalAggregation" 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 TotalAggregationComputation
totalAggregation,
            (Key
"UniqueValues" 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 UniqueValuesComputation
uniqueValues
          ]
      )