{-# 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.TimeRangeFilter
-- 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.TimeRangeFilter 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.ColumnIdentifier
import Amazonka.QuickSight.Types.ExcludePeriodConfiguration
import Amazonka.QuickSight.Types.FilterNullOption
import Amazonka.QuickSight.Types.TimeGranularity
import Amazonka.QuickSight.Types.TimeRangeFilterValue

-- | A @TimeRangeFilter@ filters values that are between two specified
-- values.
--
-- /See:/ 'newTimeRangeFilter' smart constructor.
data TimeRangeFilter = TimeRangeFilter'
  { -- | The exclude period of the time range filter.
    TimeRangeFilter -> Maybe ExcludePeriodConfiguration
excludePeriodConfiguration :: Prelude.Maybe ExcludePeriodConfiguration,
    -- | Determines whether the maximum value in the filter value range should be
    -- included in the filtered results.
    TimeRangeFilter -> Maybe Bool
includeMaximum :: Prelude.Maybe Prelude.Bool,
    -- | Determines whether the minimum value in the filter value range should be
    -- included in the filtered results.
    TimeRangeFilter -> Maybe Bool
includeMinimum :: Prelude.Maybe Prelude.Bool,
    -- | The maximum value for the filter value range.
    TimeRangeFilter -> Maybe TimeRangeFilterValue
rangeMaximumValue :: Prelude.Maybe TimeRangeFilterValue,
    -- | The minimum value for the filter value range.
    TimeRangeFilter -> Maybe TimeRangeFilterValue
rangeMinimumValue :: Prelude.Maybe TimeRangeFilterValue,
    -- | The level of time precision that is used to aggregate @DateTime@ values.
    TimeRangeFilter -> Maybe TimeGranularity
timeGranularity :: Prelude.Maybe TimeGranularity,
    -- | An identifier that uniquely identifies a filter within a dashboard,
    -- analysis, or template.
    TimeRangeFilter -> Text
filterId :: Prelude.Text,
    -- | The column that the filter is applied to.
    TimeRangeFilter -> ColumnIdentifier
column :: ColumnIdentifier,
    -- | This option determines how null values should be treated when filtering
    -- data.
    --
    -- -   @ALL_VALUES@: Include null values in filtered results.
    --
    -- -   @NULLS_ONLY@: Only include null values in filtered results.
    --
    -- -   @NON_NULLS_ONLY@: Exclude null values from filtered results.
    TimeRangeFilter -> FilterNullOption
nullOption :: FilterNullOption
  }
  deriving (TimeRangeFilter -> TimeRangeFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeRangeFilter -> TimeRangeFilter -> Bool
$c/= :: TimeRangeFilter -> TimeRangeFilter -> Bool
== :: TimeRangeFilter -> TimeRangeFilter -> Bool
$c== :: TimeRangeFilter -> TimeRangeFilter -> Bool
Prelude.Eq, Int -> TimeRangeFilter -> ShowS
[TimeRangeFilter] -> ShowS
TimeRangeFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeRangeFilter] -> ShowS
$cshowList :: [TimeRangeFilter] -> ShowS
show :: TimeRangeFilter -> String
$cshow :: TimeRangeFilter -> String
showsPrec :: Int -> TimeRangeFilter -> ShowS
$cshowsPrec :: Int -> TimeRangeFilter -> ShowS
Prelude.Show, forall x. Rep TimeRangeFilter x -> TimeRangeFilter
forall x. TimeRangeFilter -> Rep TimeRangeFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimeRangeFilter x -> TimeRangeFilter
$cfrom :: forall x. TimeRangeFilter -> Rep TimeRangeFilter x
Prelude.Generic)

-- |
-- Create a value of 'TimeRangeFilter' 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:
--
-- 'excludePeriodConfiguration', 'timeRangeFilter_excludePeriodConfiguration' - The exclude period of the time range filter.
--
-- 'includeMaximum', 'timeRangeFilter_includeMaximum' - Determines whether the maximum value in the filter value range should be
-- included in the filtered results.
--
-- 'includeMinimum', 'timeRangeFilter_includeMinimum' - Determines whether the minimum value in the filter value range should be
-- included in the filtered results.
--
-- 'rangeMaximumValue', 'timeRangeFilter_rangeMaximumValue' - The maximum value for the filter value range.
--
-- 'rangeMinimumValue', 'timeRangeFilter_rangeMinimumValue' - The minimum value for the filter value range.
--
-- 'timeGranularity', 'timeRangeFilter_timeGranularity' - The level of time precision that is used to aggregate @DateTime@ values.
--
-- 'filterId', 'timeRangeFilter_filterId' - An identifier that uniquely identifies a filter within a dashboard,
-- analysis, or template.
--
-- 'column', 'timeRangeFilter_column' - The column that the filter is applied to.
--
-- 'nullOption', 'timeRangeFilter_nullOption' - This option determines how null values should be treated when filtering
-- data.
--
-- -   @ALL_VALUES@: Include null values in filtered results.
--
-- -   @NULLS_ONLY@: Only include null values in filtered results.
--
-- -   @NON_NULLS_ONLY@: Exclude null values from filtered results.
newTimeRangeFilter ::
  -- | 'filterId'
  Prelude.Text ->
  -- | 'column'
  ColumnIdentifier ->
  -- | 'nullOption'
  FilterNullOption ->
  TimeRangeFilter
newTimeRangeFilter :: Text -> ColumnIdentifier -> FilterNullOption -> TimeRangeFilter
newTimeRangeFilter Text
pFilterId_ ColumnIdentifier
pColumn_ FilterNullOption
pNullOption_ =
  TimeRangeFilter'
    { $sel:excludePeriodConfiguration:TimeRangeFilter' :: Maybe ExcludePeriodConfiguration
excludePeriodConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:includeMaximum:TimeRangeFilter' :: Maybe Bool
includeMaximum = forall a. Maybe a
Prelude.Nothing,
      $sel:includeMinimum:TimeRangeFilter' :: Maybe Bool
includeMinimum = forall a. Maybe a
Prelude.Nothing,
      $sel:rangeMaximumValue:TimeRangeFilter' :: Maybe TimeRangeFilterValue
rangeMaximumValue = forall a. Maybe a
Prelude.Nothing,
      $sel:rangeMinimumValue:TimeRangeFilter' :: Maybe TimeRangeFilterValue
rangeMinimumValue = forall a. Maybe a
Prelude.Nothing,
      $sel:timeGranularity:TimeRangeFilter' :: Maybe TimeGranularity
timeGranularity = forall a. Maybe a
Prelude.Nothing,
      $sel:filterId:TimeRangeFilter' :: Text
filterId = Text
pFilterId_,
      $sel:column:TimeRangeFilter' :: ColumnIdentifier
column = ColumnIdentifier
pColumn_,
      $sel:nullOption:TimeRangeFilter' :: FilterNullOption
nullOption = FilterNullOption
pNullOption_
    }

-- | The exclude period of the time range filter.
timeRangeFilter_excludePeriodConfiguration :: Lens.Lens' TimeRangeFilter (Prelude.Maybe ExcludePeriodConfiguration)
timeRangeFilter_excludePeriodConfiguration :: Lens' TimeRangeFilter (Maybe ExcludePeriodConfiguration)
timeRangeFilter_excludePeriodConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe ExcludePeriodConfiguration
excludePeriodConfiguration :: Maybe ExcludePeriodConfiguration
$sel:excludePeriodConfiguration:TimeRangeFilter' :: TimeRangeFilter -> Maybe ExcludePeriodConfiguration
excludePeriodConfiguration} -> Maybe ExcludePeriodConfiguration
excludePeriodConfiguration) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe ExcludePeriodConfiguration
a -> TimeRangeFilter
s {$sel:excludePeriodConfiguration:TimeRangeFilter' :: Maybe ExcludePeriodConfiguration
excludePeriodConfiguration = Maybe ExcludePeriodConfiguration
a} :: TimeRangeFilter)

-- | Determines whether the maximum value in the filter value range should be
-- included in the filtered results.
timeRangeFilter_includeMaximum :: Lens.Lens' TimeRangeFilter (Prelude.Maybe Prelude.Bool)
timeRangeFilter_includeMaximum :: Lens' TimeRangeFilter (Maybe Bool)
timeRangeFilter_includeMaximum = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe Bool
includeMaximum :: Maybe Bool
$sel:includeMaximum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
includeMaximum} -> Maybe Bool
includeMaximum) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe Bool
a -> TimeRangeFilter
s {$sel:includeMaximum:TimeRangeFilter' :: Maybe Bool
includeMaximum = Maybe Bool
a} :: TimeRangeFilter)

-- | Determines whether the minimum value in the filter value range should be
-- included in the filtered results.
timeRangeFilter_includeMinimum :: Lens.Lens' TimeRangeFilter (Prelude.Maybe Prelude.Bool)
timeRangeFilter_includeMinimum :: Lens' TimeRangeFilter (Maybe Bool)
timeRangeFilter_includeMinimum = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe Bool
includeMinimum :: Maybe Bool
$sel:includeMinimum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
includeMinimum} -> Maybe Bool
includeMinimum) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe Bool
a -> TimeRangeFilter
s {$sel:includeMinimum:TimeRangeFilter' :: Maybe Bool
includeMinimum = Maybe Bool
a} :: TimeRangeFilter)

-- | The maximum value for the filter value range.
timeRangeFilter_rangeMaximumValue :: Lens.Lens' TimeRangeFilter (Prelude.Maybe TimeRangeFilterValue)
timeRangeFilter_rangeMaximumValue :: Lens' TimeRangeFilter (Maybe TimeRangeFilterValue)
timeRangeFilter_rangeMaximumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe TimeRangeFilterValue
rangeMaximumValue :: Maybe TimeRangeFilterValue
$sel:rangeMaximumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
rangeMaximumValue} -> Maybe TimeRangeFilterValue
rangeMaximumValue) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe TimeRangeFilterValue
a -> TimeRangeFilter
s {$sel:rangeMaximumValue:TimeRangeFilter' :: Maybe TimeRangeFilterValue
rangeMaximumValue = Maybe TimeRangeFilterValue
a} :: TimeRangeFilter)

-- | The minimum value for the filter value range.
timeRangeFilter_rangeMinimumValue :: Lens.Lens' TimeRangeFilter (Prelude.Maybe TimeRangeFilterValue)
timeRangeFilter_rangeMinimumValue :: Lens' TimeRangeFilter (Maybe TimeRangeFilterValue)
timeRangeFilter_rangeMinimumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe TimeRangeFilterValue
rangeMinimumValue :: Maybe TimeRangeFilterValue
$sel:rangeMinimumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
rangeMinimumValue} -> Maybe TimeRangeFilterValue
rangeMinimumValue) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe TimeRangeFilterValue
a -> TimeRangeFilter
s {$sel:rangeMinimumValue:TimeRangeFilter' :: Maybe TimeRangeFilterValue
rangeMinimumValue = Maybe TimeRangeFilterValue
a} :: TimeRangeFilter)

-- | The level of time precision that is used to aggregate @DateTime@ values.
timeRangeFilter_timeGranularity :: Lens.Lens' TimeRangeFilter (Prelude.Maybe TimeGranularity)
timeRangeFilter_timeGranularity :: Lens' TimeRangeFilter (Maybe TimeGranularity)
timeRangeFilter_timeGranularity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Maybe TimeGranularity
timeGranularity :: Maybe TimeGranularity
$sel:timeGranularity:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeGranularity
timeGranularity} -> Maybe TimeGranularity
timeGranularity) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Maybe TimeGranularity
a -> TimeRangeFilter
s {$sel:timeGranularity:TimeRangeFilter' :: Maybe TimeGranularity
timeGranularity = Maybe TimeGranularity
a} :: TimeRangeFilter)

-- | An identifier that uniquely identifies a filter within a dashboard,
-- analysis, or template.
timeRangeFilter_filterId :: Lens.Lens' TimeRangeFilter Prelude.Text
timeRangeFilter_filterId :: Lens' TimeRangeFilter Text
timeRangeFilter_filterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {Text
filterId :: Text
$sel:filterId:TimeRangeFilter' :: TimeRangeFilter -> Text
filterId} -> Text
filterId) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} Text
a -> TimeRangeFilter
s {$sel:filterId:TimeRangeFilter' :: Text
filterId = Text
a} :: TimeRangeFilter)

-- | The column that the filter is applied to.
timeRangeFilter_column :: Lens.Lens' TimeRangeFilter ColumnIdentifier
timeRangeFilter_column :: Lens' TimeRangeFilter ColumnIdentifier
timeRangeFilter_column = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {ColumnIdentifier
column :: ColumnIdentifier
$sel:column:TimeRangeFilter' :: TimeRangeFilter -> ColumnIdentifier
column} -> ColumnIdentifier
column) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} ColumnIdentifier
a -> TimeRangeFilter
s {$sel:column:TimeRangeFilter' :: ColumnIdentifier
column = ColumnIdentifier
a} :: TimeRangeFilter)

-- | This option determines how null values should be treated when filtering
-- data.
--
-- -   @ALL_VALUES@: Include null values in filtered results.
--
-- -   @NULLS_ONLY@: Only include null values in filtered results.
--
-- -   @NON_NULLS_ONLY@: Exclude null values from filtered results.
timeRangeFilter_nullOption :: Lens.Lens' TimeRangeFilter FilterNullOption
timeRangeFilter_nullOption :: Lens' TimeRangeFilter FilterNullOption
timeRangeFilter_nullOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRangeFilter' {FilterNullOption
nullOption :: FilterNullOption
$sel:nullOption:TimeRangeFilter' :: TimeRangeFilter -> FilterNullOption
nullOption} -> FilterNullOption
nullOption) (\s :: TimeRangeFilter
s@TimeRangeFilter' {} FilterNullOption
a -> TimeRangeFilter
s {$sel:nullOption:TimeRangeFilter' :: FilterNullOption
nullOption = FilterNullOption
a} :: TimeRangeFilter)

instance Data.FromJSON TimeRangeFilter where
  parseJSON :: Value -> Parser TimeRangeFilter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimeRangeFilter"
      ( \Object
x ->
          Maybe ExcludePeriodConfiguration
-> Maybe Bool
-> Maybe Bool
-> Maybe TimeRangeFilterValue
-> Maybe TimeRangeFilterValue
-> Maybe TimeGranularity
-> Text
-> ColumnIdentifier
-> FilterNullOption
-> TimeRangeFilter
TimeRangeFilter'
            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
"ExcludePeriodConfiguration")
            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
"IncludeMaximum")
            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
"IncludeMinimum")
            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
"RangeMaximumValue")
            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
"RangeMinimumValue")
            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
"TimeGranularity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FilterId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Column")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NullOption")
      )

instance Prelude.Hashable TimeRangeFilter where
  hashWithSalt :: Int -> TimeRangeFilter -> Int
hashWithSalt Int
_salt TimeRangeFilter' {Maybe Bool
Maybe TimeGranularity
Maybe TimeRangeFilterValue
Maybe ExcludePeriodConfiguration
Text
ColumnIdentifier
FilterNullOption
nullOption :: FilterNullOption
column :: ColumnIdentifier
filterId :: Text
timeGranularity :: Maybe TimeGranularity
rangeMinimumValue :: Maybe TimeRangeFilterValue
rangeMaximumValue :: Maybe TimeRangeFilterValue
includeMinimum :: Maybe Bool
includeMaximum :: Maybe Bool
excludePeriodConfiguration :: Maybe ExcludePeriodConfiguration
$sel:nullOption:TimeRangeFilter' :: TimeRangeFilter -> FilterNullOption
$sel:column:TimeRangeFilter' :: TimeRangeFilter -> ColumnIdentifier
$sel:filterId:TimeRangeFilter' :: TimeRangeFilter -> Text
$sel:timeGranularity:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeGranularity
$sel:rangeMinimumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:rangeMaximumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:includeMinimum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:includeMaximum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:excludePeriodConfiguration:TimeRangeFilter' :: TimeRangeFilter -> Maybe ExcludePeriodConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExcludePeriodConfiguration
excludePeriodConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeMaximum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeMinimum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeRangeFilterValue
rangeMaximumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeRangeFilterValue
rangeMinimumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeGranularity
timeGranularity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
filterId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ColumnIdentifier
column
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FilterNullOption
nullOption

instance Prelude.NFData TimeRangeFilter where
  rnf :: TimeRangeFilter -> ()
rnf TimeRangeFilter' {Maybe Bool
Maybe TimeGranularity
Maybe TimeRangeFilterValue
Maybe ExcludePeriodConfiguration
Text
ColumnIdentifier
FilterNullOption
nullOption :: FilterNullOption
column :: ColumnIdentifier
filterId :: Text
timeGranularity :: Maybe TimeGranularity
rangeMinimumValue :: Maybe TimeRangeFilterValue
rangeMaximumValue :: Maybe TimeRangeFilterValue
includeMinimum :: Maybe Bool
includeMaximum :: Maybe Bool
excludePeriodConfiguration :: Maybe ExcludePeriodConfiguration
$sel:nullOption:TimeRangeFilter' :: TimeRangeFilter -> FilterNullOption
$sel:column:TimeRangeFilter' :: TimeRangeFilter -> ColumnIdentifier
$sel:filterId:TimeRangeFilter' :: TimeRangeFilter -> Text
$sel:timeGranularity:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeGranularity
$sel:rangeMinimumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:rangeMaximumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:includeMinimum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:includeMaximum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:excludePeriodConfiguration:TimeRangeFilter' :: TimeRangeFilter -> Maybe ExcludePeriodConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ExcludePeriodConfiguration
excludePeriodConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeMaximum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeMinimum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeRangeFilterValue
rangeMaximumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeRangeFilterValue
rangeMinimumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeGranularity
timeGranularity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
filterId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ColumnIdentifier
column
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FilterNullOption
nullOption

instance Data.ToJSON TimeRangeFilter where
  toJSON :: TimeRangeFilter -> Value
toJSON TimeRangeFilter' {Maybe Bool
Maybe TimeGranularity
Maybe TimeRangeFilterValue
Maybe ExcludePeriodConfiguration
Text
ColumnIdentifier
FilterNullOption
nullOption :: FilterNullOption
column :: ColumnIdentifier
filterId :: Text
timeGranularity :: Maybe TimeGranularity
rangeMinimumValue :: Maybe TimeRangeFilterValue
rangeMaximumValue :: Maybe TimeRangeFilterValue
includeMinimum :: Maybe Bool
includeMaximum :: Maybe Bool
excludePeriodConfiguration :: Maybe ExcludePeriodConfiguration
$sel:nullOption:TimeRangeFilter' :: TimeRangeFilter -> FilterNullOption
$sel:column:TimeRangeFilter' :: TimeRangeFilter -> ColumnIdentifier
$sel:filterId:TimeRangeFilter' :: TimeRangeFilter -> Text
$sel:timeGranularity:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeGranularity
$sel:rangeMinimumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:rangeMaximumValue:TimeRangeFilter' :: TimeRangeFilter -> Maybe TimeRangeFilterValue
$sel:includeMinimum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:includeMaximum:TimeRangeFilter' :: TimeRangeFilter -> Maybe Bool
$sel:excludePeriodConfiguration:TimeRangeFilter' :: TimeRangeFilter -> Maybe ExcludePeriodConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ExcludePeriodConfiguration" 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 ExcludePeriodConfiguration
excludePeriodConfiguration,
            (Key
"IncludeMaximum" 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 Bool
includeMaximum,
            (Key
"IncludeMinimum" 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 Bool
includeMinimum,
            (Key
"RangeMaximumValue" 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 TimeRangeFilterValue
rangeMaximumValue,
            (Key
"RangeMinimumValue" 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 TimeRangeFilterValue
rangeMinimumValue,
            (Key
"TimeGranularity" 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 TimeGranularity
timeGranularity,
            forall a. a -> Maybe a
Prelude.Just (Key
"FilterId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
filterId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Column" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ColumnIdentifier
column),
            forall a. a -> Maybe a
Prelude.Just (Key
"NullOption" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FilterNullOption
nullOption)
          ]
      )