import { EsFieldName } from '../../../../../../../common/types/fields' ; import { PivotSupportedAggs , PIVOT_SUPPORTED_AGGS , } from '../../../../../../../common/types/pivot_aggs' ; import { PERCENTILES_AGG_DEFAULT_PERCENTS , PivotAggsConfigWithUiSupport , } from '../../../../../common' ; import { getFilterAggConfig } from './filter_agg/config' ; import { getTopMetricsAggConfig } from './top_metrics_agg/config' ; /**
 * Provides a configuration based on the aggregation type.
 */ export function getDefaultAggregationConfig ( aggName , dropDownName , fieldName , agg ) { const commonConfig = { agg , aggName , dropDownName , field : fieldName , } ; switch ( agg ) { case PIVOT_SUPPORTED_AGGS . PERCENTILES : return { ... commonConfig , agg , percents : PERCENTILES_AGG_DEFAULT_PERCENTS , } ; case PIVOT_SUPPORTED_AGGS . FILTER : return getFilterAggConfig ( commonConfig ) ; case PIVOT_SUPPORTED_AGGS . TOP_METRICS : return getTopMetricsAggConfig ( { ... commonConfig , aggName : PIVOT_SUPPORTED_AGGS . TOP_METRICS , } ) ; default : return commonConfig ; } }