/**
 * Function for generating attribute statistics in a [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/) based on
 * values returned from a given field.
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) must have the `supportsRenderer` and `supportsLayerQuery` capabilities enabled unless a predefined [statistics](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/statistics/types/#SummaryStatisticsResult) object is provided to the `statistics` parameter of the method. To check a SceneLayer's capabilities, use the [SceneLayer.getFieldUsageInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/#getFieldUsageInfo) method.
 * > You cannot generate statistics using SQL expressions for client-side [FeatureLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
 * > in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 * >  The `normalizationType` parameter only normalizes data returned by a `field`. It does not apply to values returned from a `valueExpression` or `sqlExpression`.
 *
 * @since 4.2
 */
import type { SummaryStatisticsParameters, SummaryStatisticsResult } from "./types.js";

/**
 * Returns an object containing statistics describing a set of values returned
 * from a field (or expression) in a [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/).
 *
 * @param parameters - The function parameters.
 * @returns Returns a promise that resolves to [SummaryStatisticsResult](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/statistics/types/#SummaryStatisticsResult).
 * @example
 * summaryStatistics({
 *   layer: featureLayer,
 *   valueExpression: "( ($feature.POP2020 - $feature.POP2010) / $feature.POP2010 ) * 100"
 *   view: mapView
 * }).then((stats) => {
 *   colorSlider.statistics = stats;
 * });
 * @example
 * summaryStatistics({
 *   layer: featureLayer,
 *   field: "Population",
 *   normalizationType: "natural-log",
 *   sqlWhere: "Population > 0",
 *   numBins: 100
 * }).then((stats) => {
 *   histogramElement.average = stats.avg;
 * });
 */
export default function summaryStatistics(parameters: SummaryStatisticsParameters): Promise<SummaryStatisticsResult>;