{-# 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.QuickSight.Types.CategoricalMeasureField 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.CategoricalAggregationFunction
import Amazonka.QuickSight.Types.ColumnIdentifier
import Amazonka.QuickSight.Types.StringFormatConfiguration
data CategoricalMeasureField = CategoricalMeasureField'
{
CategoricalMeasureField -> Maybe CategoricalAggregationFunction
aggregationFunction :: Prelude.Maybe CategoricalAggregationFunction,
CategoricalMeasureField -> Maybe StringFormatConfiguration
formatConfiguration :: Prelude.Maybe StringFormatConfiguration,
CategoricalMeasureField -> Text
fieldId :: Prelude.Text,
CategoricalMeasureField -> ColumnIdentifier
column :: ColumnIdentifier
}
deriving (CategoricalMeasureField -> CategoricalMeasureField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CategoricalMeasureField -> CategoricalMeasureField -> Bool
$c/= :: CategoricalMeasureField -> CategoricalMeasureField -> Bool
== :: CategoricalMeasureField -> CategoricalMeasureField -> Bool
$c== :: CategoricalMeasureField -> CategoricalMeasureField -> Bool
Prelude.Eq, Int -> CategoricalMeasureField -> ShowS
[CategoricalMeasureField] -> ShowS
CategoricalMeasureField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CategoricalMeasureField] -> ShowS
$cshowList :: [CategoricalMeasureField] -> ShowS
show :: CategoricalMeasureField -> String
$cshow :: CategoricalMeasureField -> String
showsPrec :: Int -> CategoricalMeasureField -> ShowS
$cshowsPrec :: Int -> CategoricalMeasureField -> ShowS
Prelude.Show, forall x. Rep CategoricalMeasureField x -> CategoricalMeasureField
forall x. CategoricalMeasureField -> Rep CategoricalMeasureField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CategoricalMeasureField x -> CategoricalMeasureField
$cfrom :: forall x. CategoricalMeasureField -> Rep CategoricalMeasureField x
Prelude.Generic)
newCategoricalMeasureField ::
Prelude.Text ->
ColumnIdentifier ->
CategoricalMeasureField
newCategoricalMeasureField :: Text -> ColumnIdentifier -> CategoricalMeasureField
newCategoricalMeasureField Text
pFieldId_ ColumnIdentifier
pColumn_ =
CategoricalMeasureField'
{ $sel:aggregationFunction:CategoricalMeasureField' :: Maybe CategoricalAggregationFunction
aggregationFunction =
forall a. Maybe a
Prelude.Nothing,
$sel:formatConfiguration:CategoricalMeasureField' :: Maybe StringFormatConfiguration
formatConfiguration = forall a. Maybe a
Prelude.Nothing,
$sel:fieldId:CategoricalMeasureField' :: Text
fieldId = Text
pFieldId_,
$sel:column:CategoricalMeasureField' :: ColumnIdentifier
column = ColumnIdentifier
pColumn_
}
categoricalMeasureField_aggregationFunction :: Lens.Lens' CategoricalMeasureField (Prelude.Maybe CategoricalAggregationFunction)
categoricalMeasureField_aggregationFunction :: Lens'
CategoricalMeasureField (Maybe CategoricalAggregationFunction)
categoricalMeasureField_aggregationFunction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalMeasureField' {Maybe CategoricalAggregationFunction
aggregationFunction :: Maybe CategoricalAggregationFunction
$sel:aggregationFunction:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe CategoricalAggregationFunction
aggregationFunction} -> Maybe CategoricalAggregationFunction
aggregationFunction) (\s :: CategoricalMeasureField
s@CategoricalMeasureField' {} Maybe CategoricalAggregationFunction
a -> CategoricalMeasureField
s {$sel:aggregationFunction:CategoricalMeasureField' :: Maybe CategoricalAggregationFunction
aggregationFunction = Maybe CategoricalAggregationFunction
a} :: CategoricalMeasureField)
categoricalMeasureField_formatConfiguration :: Lens.Lens' CategoricalMeasureField (Prelude.Maybe StringFormatConfiguration)
categoricalMeasureField_formatConfiguration :: Lens' CategoricalMeasureField (Maybe StringFormatConfiguration)
categoricalMeasureField_formatConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalMeasureField' {Maybe StringFormatConfiguration
formatConfiguration :: Maybe StringFormatConfiguration
$sel:formatConfiguration:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe StringFormatConfiguration
formatConfiguration} -> Maybe StringFormatConfiguration
formatConfiguration) (\s :: CategoricalMeasureField
s@CategoricalMeasureField' {} Maybe StringFormatConfiguration
a -> CategoricalMeasureField
s {$sel:formatConfiguration:CategoricalMeasureField' :: Maybe StringFormatConfiguration
formatConfiguration = Maybe StringFormatConfiguration
a} :: CategoricalMeasureField)
categoricalMeasureField_fieldId :: Lens.Lens' CategoricalMeasureField Prelude.Text
categoricalMeasureField_fieldId :: Lens' CategoricalMeasureField Text
categoricalMeasureField_fieldId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalMeasureField' {Text
fieldId :: Text
$sel:fieldId:CategoricalMeasureField' :: CategoricalMeasureField -> Text
fieldId} -> Text
fieldId) (\s :: CategoricalMeasureField
s@CategoricalMeasureField' {} Text
a -> CategoricalMeasureField
s {$sel:fieldId:CategoricalMeasureField' :: Text
fieldId = Text
a} :: CategoricalMeasureField)
categoricalMeasureField_column :: Lens.Lens' CategoricalMeasureField ColumnIdentifier
categoricalMeasureField_column :: Lens' CategoricalMeasureField ColumnIdentifier
categoricalMeasureField_column = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalMeasureField' {ColumnIdentifier
column :: ColumnIdentifier
$sel:column:CategoricalMeasureField' :: CategoricalMeasureField -> ColumnIdentifier
column} -> ColumnIdentifier
column) (\s :: CategoricalMeasureField
s@CategoricalMeasureField' {} ColumnIdentifier
a -> CategoricalMeasureField
s {$sel:column:CategoricalMeasureField' :: ColumnIdentifier
column = ColumnIdentifier
a} :: CategoricalMeasureField)
instance Data.FromJSON CategoricalMeasureField where
parseJSON :: Value -> Parser CategoricalMeasureField
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CategoricalMeasureField"
( \Object
x ->
Maybe CategoricalAggregationFunction
-> Maybe StringFormatConfiguration
-> Text
-> ColumnIdentifier
-> CategoricalMeasureField
CategoricalMeasureField'
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
"AggregationFunction")
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
"FormatConfiguration")
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
"FieldId")
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")
)
instance Prelude.Hashable CategoricalMeasureField where
hashWithSalt :: Int -> CategoricalMeasureField -> Int
hashWithSalt Int
_salt CategoricalMeasureField' {Maybe CategoricalAggregationFunction
Maybe StringFormatConfiguration
Text
ColumnIdentifier
column :: ColumnIdentifier
fieldId :: Text
formatConfiguration :: Maybe StringFormatConfiguration
aggregationFunction :: Maybe CategoricalAggregationFunction
$sel:column:CategoricalMeasureField' :: CategoricalMeasureField -> ColumnIdentifier
$sel:fieldId:CategoricalMeasureField' :: CategoricalMeasureField -> Text
$sel:formatConfiguration:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe StringFormatConfiguration
$sel:aggregationFunction:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe CategoricalAggregationFunction
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CategoricalAggregationFunction
aggregationFunction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StringFormatConfiguration
formatConfiguration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fieldId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ColumnIdentifier
column
instance Prelude.NFData CategoricalMeasureField where
rnf :: CategoricalMeasureField -> ()
rnf CategoricalMeasureField' {Maybe CategoricalAggregationFunction
Maybe StringFormatConfiguration
Text
ColumnIdentifier
column :: ColumnIdentifier
fieldId :: Text
formatConfiguration :: Maybe StringFormatConfiguration
aggregationFunction :: Maybe CategoricalAggregationFunction
$sel:column:CategoricalMeasureField' :: CategoricalMeasureField -> ColumnIdentifier
$sel:fieldId:CategoricalMeasureField' :: CategoricalMeasureField -> Text
$sel:formatConfiguration:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe StringFormatConfiguration
$sel:aggregationFunction:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe CategoricalAggregationFunction
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CategoricalAggregationFunction
aggregationFunction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StringFormatConfiguration
formatConfiguration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fieldId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ColumnIdentifier
column
instance Data.ToJSON CategoricalMeasureField where
toJSON :: CategoricalMeasureField -> Value
toJSON CategoricalMeasureField' {Maybe CategoricalAggregationFunction
Maybe StringFormatConfiguration
Text
ColumnIdentifier
column :: ColumnIdentifier
fieldId :: Text
formatConfiguration :: Maybe StringFormatConfiguration
aggregationFunction :: Maybe CategoricalAggregationFunction
$sel:column:CategoricalMeasureField' :: CategoricalMeasureField -> ColumnIdentifier
$sel:fieldId:CategoricalMeasureField' :: CategoricalMeasureField -> Text
$sel:formatConfiguration:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe StringFormatConfiguration
$sel:aggregationFunction:CategoricalMeasureField' :: CategoricalMeasureField -> Maybe CategoricalAggregationFunction
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AggregationFunction" 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 CategoricalAggregationFunction
aggregationFunction,
(Key
"FormatConfiguration" 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 StringFormatConfiguration
formatConfiguration,
forall a. a -> Maybe a
Prelude.Just (Key
"FieldId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fieldId),
forall a. a -> Maybe a
Prelude.Just (Key
"Column" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ColumnIdentifier
column)
]
)