import type PopupTemplate from "../../PopupTemplate.js";
import type AggregateField from "./AggregateField.js";
import type FieldConfiguration from "./FieldConfiguration.js";
import type LabelClass from "./LabelClass.js";
import type { Clonable } from "../../core/Clonable.js";
import type { JSONSupportMixin } from "../../core/JSONSupport.js";
import type { RendererUnion } from "../../renderers/types.js";
import type { LabelClassProperties } from "./LabelClass.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";
import type { FieldConfigurationProperties } from "./FieldConfiguration.js";
import type { AggregateFieldProperties } from "./AggregateField.js";
import type { HeatmapRendererProperties } from "../../renderers/HeatmapRenderer.js";
import type { PieChartRendererProperties } from "../../renderers/PieChartRenderer.js";
import type { DictionaryRendererProperties } from "../../renderers/DictionaryRenderer.js";
import type { DotDensityRendererProperties } from "../../renderers/DotDensityRenderer.js";
import type { UniqueValueRendererProperties } from "../../renderers/UniqueValueRenderer.js";
import type { ClassBreaksRendererProperties } from "../../renderers/ClassBreaksRenderer.js";
import type { SimpleRendererProperties } from "../../renderers/SimpleRenderer.js";

export interface FeatureReductionBinningProperties extends Partial<Pick<FeatureReductionBinning, "fixedBinLevel" | "labelsVisible" | "maxScale" | "popupEnabled">> {
  /**
   * An array of [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) objects that control how fields are displayed in popups and other UI elements. Each object specifies options for an individual field, such as its display name, via `alias`, and formatting rules, via `fieldFormat`. For more information, see the [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) documentation. These configurations will only be honored if the parent layer is a service-based [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/).
   *
   * > [!WARNING]
   * >
   * > Support is limited in version 5.0. For details, see the [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) documentation.
   *
   * @since 5.0
   */
  fieldConfigurations?: FieldConfigurationProperties[] | null;
  /**
   * An array of aggregate fields that summarize layer [FeatureLayer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields)
   * from features contained within each bin. These fields may be used by the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#popupTemplate),
   * [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#labelingInfo), and [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#renderer).
   *
   * @example
   * featureReduction.fields = [{
   *   name: "aggregateCount",
   *   statisticType: "count"
   * }, {
   *   name: "SUM_population",
   *   onStatisticField: "population",
   *   statisticType: "sum"
   * }, {
   *   name: "AVG_age",
   *   onStatisticField: "age",
   *   statisticType: "avg"
   * }, {
   *   name: "AVG_population_density",
   *   alias: "Average population density",
   *   onStatisticExpression: {
   *     expression: "$feature.population / AreaGeodetic($feature, 'square-miles')",
   *     title: "population density",
   *     returnType: "number"
   *   },
   *   statisticType: "avg"
   * }];
   */
  fields?: AggregateFieldProperties[];
  /**
   * Defines labels for bins as an array of
   * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). When set, labels
   * independent of the [layer.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#labelingInfo) are used
   * to convey information about each bin. This can include the count of all features in the bin,
   * the average, or sum of a numeric attribute.
   *
   * Any aggregate field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields) can be referenced in the label.
   *
   * Multiple Label classes with different `where` clauses can be used to define several
   * labels with varying styles on the same feature. Likewise, multiple label classes
   * may be used to label different types of bins (e.g. blue labels
   * for bins with few features and red labels for bins with many features).
   *
   * @example
   * // Displays the count inside the bin
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   labelingInfo: [{
   *     labelExpressionInfo: {
   *       expression: "$feature.aggregateCount"
   *     },
   *     symbol: {
   *       type: "text",
   *       color: "white",
   *       font: {
   *         size: "12px"
   *       },
   *       haloSize: 1,
   *       haloColor: "black"
   *     }
   *   }]
   * };
   */
  labelingInfo?: LabelClassProperties[] | null;
  /**
   * The [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) to apply to bins. When set, a popupTemplate
   * independent of the [layer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate) is used.
   * This popup can display summary information for each bin, such as feature count or any other field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields).
   *
   * The PopupTemplate may contain one or more [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions following
   * the specification defined by the [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup).
   * Expressions must return a string or a number and may access data values from the bin and its aggregated features
   * with the `$feature` and `$aggregatedFeatures` profile variables.
   *
   * @see [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup)
   * @example
   * // enables binning on the layer with a
   * // popup describing the number of features represented by each bin
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: "This bin contains <b>{aggregateCount}</b> features."
   *     fieldInfos: [{
   *       fieldName: "aggregateCount",
   *       format: {
   *         digitSeparator: true,
   *         places: 0
   *       }
   *     }]
   *   }
   * };
   * @example
   * // enables binning on the layer with a
   * // popup describing the average value of
   * // the temperature field
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "avg_temperature",
   *     alias: "Average temperature",
   *     onStatisticField: "temperature",
   *     statisticType: "avg"
   *   }, {
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: [{
   *       type: "text",
   *       text: "This bin contains <b>{aggregateCount}</b> features."
   *     }, {
   *       type: "text",
   *       text: "The average temperature in this bin is <b>{avg_temperature}° F</b>."
   *     }],
   *     fieldInfos: [{
   *       fieldName: "aggregateCount",
   *       format: {
   *         digitSeparator: true,
   *         places: 0
   *       }
   *     }, {
   *       fieldName: "avg_temperature",
   *       format: {
   *         places: 1
   *       }
   *     }]
   *   }
   * };
   * @example
   * // Displays an ordered list of the top 5 categories
   * // of features contained within the bin
   * layer.popupTemplate = {
   *   title: "Power plant summary",
   *   content: [{
   *    type: "expression",
   *    // lists the top 5 most common fuel types in the bin
   *    expressionInfo: {
   *      expression: `
   *        Expects($aggregatedFeatures, "fuel1")
   *
   *        var statsFS = GroupBy($aggregatedFeatures,
   *          [
   *            { name: 'Type', expression: 'fuel1'},
   *          ],
   *          [
   *            { name: 'num_features', expression: '1', statistic: 'COUNT' }
   *          ]
   *        );
   *        var ordered = Top(OrderBy(statsFs, 'num_features DESC'), 5);
   *
   *        // create an HTML ordered list as a string and return in a rich text element
   *        var list = "<ol>";
   *
   *        for (var group in ordered){
   *          list += \`<li>\${group.Type} (\${Text(group.num_features, "#,###")})</li>\`
   *        }
   *        list += "</ol>";
   *
   *        return {
   *          type: "text",
   *          text: list
   *        }
   *      `,
   *      title: "List of fuel types"
   *    }
   *  }]
   * };
   */
  popupTemplate?: PopupTemplateProperties | null;
  /**
   * The renderer used to style the bins. Depending on the renderer type,
   * features may be visualized with the same symbol or with varying symbols
   * based on the values of the provided fields. Since bins are defined geometrically
   * as polygons, only renderer and symbol types suited for polygon geometries are supported
   * (e.g. [HeatmapRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/HeatmapRenderer/) is not supported).
   *
   * Any aggregate field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields) may be used by the renderer.
   * Typically, binning visualizations use a field for aggregate count in a color
   * visual variable to visualize the total count of features within each bin.
   *
   * @see [Sample - Binning - basic configuration](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/)
   * @example
   * featureReduction.renderer = {
   *   type: "simple",  // autocasts as new SimpleRenderer()
   *   symbol: {
   *     type: "simple-fill",  // autocasts as new SimpleFillSymbol()
   *     outline: {  // autocasts as new SimpleLineSymbol()
   *       width: 0.5,
   *       color: "white"
   *     }
   *   },
   *   visualVariables: [{
   *     type: "color",
   *     field: "aggregateCount",
   *     stops: [
   *       { value: 1, color: "white" },
   *       { value: 1000, color: "blue" }
   *     ]
   *   }]
   * };
   */
  renderer?: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null;
}

/**
 * Aggregates and summarizes dense features in a layer to bins in geographic space based on predefined [geohashes](https://en.wikipedia.org/wiki/Geohash).
 * Binning is a method of representing the density of features in a grid of equally sized cells, or bins.
 *
 * Binning should only be used as a visualization technique to reduce visual clutter because of many **overlapping** features or to
 * provide a quick preview of feature density. It should not be used as a means of performing statistical analysis of data. As opposed to
 * [clustering](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/), binning aggregates features in geographic space at
 * a fixed level of detail. This means that the size of the bins does not change as the user zooms in and out of the map.
 *
 *  Display all features | Features aggregated to bins
 * ---------------------|-------------------
 * [![binning-disabled](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/binning/all-points.png)](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/) | [![binning-enabled](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/binning/binned-points.png)](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/)
 *
 * Binning is typically used to visualize large point layers, but may be used with any geometry type _(since version 4.31)_.
 * In the case of binning polyline or polygon features, the centroid of the line or polygon is used to determine the bin in which it is placed.
 * Individual parts comprising the intersection of line or polygon features to bins are not represented in the final bin statistics.
 *
 * > [!WARNING]
 * >
 * > **Usage guidelines**
 * >
 * > Use discretion when binning polygon and polyline features, as the underlying data could be misrepresented by the binning process.
 * >
 * > **Binning works best when features have a regular size _smaller_ than the bin size**. Irregularly shaped features
 * > may be misrepresented as some features may be placed in bins that do not contain the majority of the feature.
 * > As a result, some areas covered by large features may show no bins at all even though the area is completely covered by large features.
 * > As a guideline, small features like parcels, buildings, culverts, or connectors are well-suited for binning. Large, irregularly shaped features like
 * > counties, states, or countries do not need to be aggregated.
 *
 * <span id="known-limitations"></span>
 * > [!CAUTION]
 * >
 * > **Known Limitations**
 * >
 * > - Not supported in 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 * > - Supported in [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/), [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/),
 * > [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), and [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/).
 * > - Not supported in all other layer types, including [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/).
 * > - Layer views with an applied [FeatureEffect](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureEffect/) cannot be binned.
 *
 * @since 4.24
 * @see [Sample - Binning - basic configuration](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/)
 * @see [Sample - Binning - Filter by category](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning-filter/)
 * @see [Sample - Binning with aggregate fields](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning-aggregate-fields/)
 * @see [Sample - Summarize binned data using Arcade](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning-arcade-summary/)
 * @see [CSVLayer.featureReduction](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/#featureReduction)
 * @see [FeatureLayer.featureReduction](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#featureReduction)
 * @see [GeoJSONLayer.featureReduction](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#featureReduction)
 * @see [OGCFeatureLayer.featureReduction](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/#featureReduction)
 * @example
 * layer.featureReduction = {
 *   type: "binning",
 *   fields: [{
 *     name: "aggregateCount",
 *     statisticType: "count"
 *   }]
 *   renderer: {
 *     type: "simple",  // autocasts as new SimpleRenderer()
 *     symbol: {
 *       type: "simple-fill",  // autocasts as new SimpleFillSymbol()
 *       outline: {  // autocasts as new SimpleLineSymbol()
 *         width: 0.5,
 *         color: "white"
 *       }
 *     },
 *     visualVariables: [{
 *       type: "color",
 *       field: "aggregateCount",
 *       stops: [
 *         { value: 1, color: "white" },
 *         { value: 1000, color: "blue" }
 *       ]
 *     }]
 *   },
 *   popupTemplate: {
 *     content: "This bin contains <b>{aggregateCount}</b> features.",
 *     fieldInfos: [{
 *       fieldName: "aggregateCount",
 *       format: {
 *         digitSeparator: true,
 *         places: 0
 *       }
 *     }]
 *   }
 * };
 */
export default class FeatureReductionBinning extends FeatureReductionBinningSuperclass {
  constructor(properties?: FeatureReductionBinningProperties);
  /**
   * An array of [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) objects that control how fields are displayed in popups and other UI elements. Each object specifies options for an individual field, such as its display name, via `alias`, and formatting rules, via `fieldFormat`. For more information, see the [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) documentation. These configurations will only be honored if the parent layer is a service-based [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/).
   *
   * > [!WARNING]
   * >
   * > Support is limited in version 5.0. For details, see the [FieldConfiguration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) documentation.
   *
   * @since 5.0
   */
  get fieldConfigurations(): FieldConfiguration[] | null | undefined;
  set fieldConfigurations(value: FieldConfigurationProperties[] | null | undefined);
  /**
   * An array of aggregate fields that summarize layer [FeatureLayer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields)
   * from features contained within each bin. These fields may be used by the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#popupTemplate),
   * [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#labelingInfo), and [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#renderer).
   *
   * @example
   * featureReduction.fields = [{
   *   name: "aggregateCount",
   *   statisticType: "count"
   * }, {
   *   name: "SUM_population",
   *   onStatisticField: "population",
   *   statisticType: "sum"
   * }, {
   *   name: "AVG_age",
   *   onStatisticField: "age",
   *   statisticType: "avg"
   * }, {
   *   name: "AVG_population_density",
   *   alias: "Average population density",
   *   onStatisticExpression: {
   *     expression: "$feature.population / AreaGeodetic($feature, 'square-miles')",
   *     title: "population density",
   *     returnType: "number"
   *   },
   *   statisticType: "avg"
   * }];
   */
  get fields(): AggregateField[];
  set fields(value: AggregateFieldProperties[]);
  /**
   * The fixed geohash level used to create bins. Currently, bin sizes do not dynamically change as the user zooms
   * in and out of the map. Larger numbers will create smaller bins. Levels range from 1 - 9. The following table suggests
   * which bin level to use depending on the approximate view scale.
   *
   * fixedBinLevel | view.scale
   * -- | --
   * 1 | > 120,000,000
   * 2 | ~88,000,000
   * 3 | ~14,000,000
   * 4 | ~3,000,000
   * 5 | ~500,000
   * 6 | ~84,000
   * 7 | ~10,000
   * 8 | ~3,000
   * 9 | ~400
   *
   * @default 3
   * @example featureReduction.fixedBinLevel = 4;
   */
  accessor fixedBinLevel: number | null | undefined;
  /**
   * Defines labels for bins as an array of
   * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). When set, labels
   * independent of the [layer.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#labelingInfo) are used
   * to convey information about each bin. This can include the count of all features in the bin,
   * the average, or sum of a numeric attribute.
   *
   * Any aggregate field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields) can be referenced in the label.
   *
   * Multiple Label classes with different `where` clauses can be used to define several
   * labels with varying styles on the same feature. Likewise, multiple label classes
   * may be used to label different types of bins (e.g. blue labels
   * for bins with few features and red labels for bins with many features).
   *
   * @example
   * // Displays the count inside the bin
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   labelingInfo: [{
   *     labelExpressionInfo: {
   *       expression: "$feature.aggregateCount"
   *     },
   *     symbol: {
   *       type: "text",
   *       color: "white",
   *       font: {
   *         size: "12px"
   *       },
   *       haloSize: 1,
   *       haloColor: "black"
   *     }
   *   }]
   * };
   */
  get labelingInfo(): LabelClass[] | null | undefined;
  set labelingInfo(value: LabelClassProperties[] | null | undefined);
  /**
   * Indicates whether to display labels for the bins. If `true`, labels will
   * appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#labelingInfo) property.
   *
   * @default true
   * @example
   * // Turns off bin labels, but preserves labelingInfo
   * const featureReduction = layer.featureReduction.clone();
   * featureReduction.labelsVisible = false;
   * layer.featureReduction = featureReduction;
   */
  accessor labelsVisible: boolean;
  /**
   * Defines the maximum [view scale](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#scale) at which binning is enabled.
   * If the user zooms in beyond the scale specified here, binning will be disabled and only individual features
   * will be displayed in the view.
   * Once the user zooms out past this scale, binning will be re-enabled.
   * A value of `0` means binning is always enabled, and therefore binning will be visible at
   * all view scales.
   *
   * @default 0
   * @since 4.26
   * @example
   * // binning is disabled when the user zooms
   * // in beyond a 1:50,000 view scale
   * layer.featureReduction = {
   *   type: "binning",
   *   maxScale: 50000
   * };
   */
  accessor maxScale: number;
  /**
   * Indicates whether to display a popup when a user clicks or touches a bin. If `false`, the popup as defined
   * in the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#popupTemplate) will be persisted, but won't be displayed
   * on click/tap.
   *
   * @default true
   * @example
   * // Turns off popups, but preserves popupTemplate
   * const featureReduction = layer.featureReduction.clone();
   * featureReduction.popupEnabled = false;
   * layer.featureReduction = featureReduction;
   */
  accessor popupEnabled: boolean;
  /**
   * The [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) to apply to bins. When set, a popupTemplate
   * independent of the [layer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate) is used.
   * This popup can display summary information for each bin, such as feature count or any other field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields).
   *
   * The PopupTemplate may contain one or more [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions following
   * the specification defined by the [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup).
   * Expressions must return a string or a number and may access data values from the bin and its aggregated features
   * with the `$feature` and `$aggregatedFeatures` profile variables.
   *
   * @see [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup)
   * @example
   * // enables binning on the layer with a
   * // popup describing the number of features represented by each bin
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: "This bin contains <b>{aggregateCount}</b> features."
   *     fieldInfos: [{
   *       fieldName: "aggregateCount",
   *       format: {
   *         digitSeparator: true,
   *         places: 0
   *       }
   *     }]
   *   }
   * };
   * @example
   * // enables binning on the layer with a
   * // popup describing the average value of
   * // the temperature field
   * layer.featureReduction = {
   *   type: "binning",
   *   fields: [{
   *     name: "avg_temperature",
   *     alias: "Average temperature",
   *     onStatisticField: "temperature",
   *     statisticType: "avg"
   *   }, {
   *     name: "aggregateCount",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: [{
   *       type: "text",
   *       text: "This bin contains <b>{aggregateCount}</b> features."
   *     }, {
   *       type: "text",
   *       text: "The average temperature in this bin is <b>{avg_temperature}° F</b>."
   *     }],
   *     fieldInfos: [{
   *       fieldName: "aggregateCount",
   *       format: {
   *         digitSeparator: true,
   *         places: 0
   *       }
   *     }, {
   *       fieldName: "avg_temperature",
   *       format: {
   *         places: 1
   *       }
   *     }]
   *   }
   * };
   * @example
   * // Displays an ordered list of the top 5 categories
   * // of features contained within the bin
   * layer.popupTemplate = {
   *   title: "Power plant summary",
   *   content: [{
   *    type: "expression",
   *    // lists the top 5 most common fuel types in the bin
   *    expressionInfo: {
   *      expression: `
   *        Expects($aggregatedFeatures, "fuel1")
   *
   *        var statsFS = GroupBy($aggregatedFeatures,
   *          [
   *            { name: 'Type', expression: 'fuel1'},
   *          ],
   *          [
   *            { name: 'num_features', expression: '1', statistic: 'COUNT' }
   *          ]
   *        );
   *        var ordered = Top(OrderBy(statsFs, 'num_features DESC'), 5);
   *
   *        // create an HTML ordered list as a string and return in a rich text element
   *        var list = "<ol>";
   *
   *        for (var group in ordered){
   *          list += \`<li>\${group.Type} (\${Text(group.num_features, "#,###")})</li>\`
   *        }
   *        list += "</ol>";
   *
   *        return {
   *          type: "text",
   *          text: list
   *        }
   *      `,
   *      title: "List of fuel types"
   *    }
   *  }]
   * };
   */
  get popupTemplate(): PopupTemplate | null | undefined;
  set popupTemplate(value: PopupTemplateProperties | null | undefined);
  /**
   * The renderer used to style the bins. Depending on the renderer type,
   * features may be visualized with the same symbol or with varying symbols
   * based on the values of the provided fields. Since bins are defined geometrically
   * as polygons, only renderer and symbol types suited for polygon geometries are supported
   * (e.g. [HeatmapRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/HeatmapRenderer/) is not supported).
   *
   * Any aggregate field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#fields) may be used by the renderer.
   * Typically, binning visualizations use a field for aggregate count in a color
   * visual variable to visualize the total count of features within each bin.
   *
   * @see [Sample - Binning - basic configuration](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/)
   * @example
   * featureReduction.renderer = {
   *   type: "simple",  // autocasts as new SimpleRenderer()
   *   symbol: {
   *     type: "simple-fill",  // autocasts as new SimpleFillSymbol()
   *     outline: {  // autocasts as new SimpleLineSymbol()
   *       width: 0.5,
   *       color: "white"
   *     }
   *   },
   *   visualVariables: [{
   *     type: "color",
   *     field: "aggregateCount",
   *     stops: [
   *       { value: 1, color: "white" },
   *       { value: 1000, color: "blue" }
   *     ]
   *   }]
   * };
   */
  get renderer(): RendererUnion | null | undefined;
  set renderer(value: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null | undefined);
  /**
   * The feature reduction type.
   *
   * @example
   * // enables binning on the layer
   * layer.featureReduction = {
   *   type: "binning"
   * };
   */
  get type(): "binning";
  /**
   * Returns the [AggregateField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AggregateField/) instance for a field name (case-insensitive).
   *
   * @param fieldName - The name of the field.
   * @returns The matching field or `undefined`.
   * @since 5.0
   * @see [fields](#fields)
   */
  getField(fieldName: string): AggregateField | null | undefined;
  /**
   * Returns the alias of the specified field.
   *
   * The alias is resolved in the following order:
   *
   * 1. [Field configuration alias](#fieldConfigurations)
   * 2. [AggregateField.alias](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AggregateField/#alias) defined on the field.
   *
   * @param fieldName - The name of the field.
   * @returns The field alias of the specified field.
   * @since 5.0
   * @see [fieldConfigurations](#fieldConfigurations)
   * @see [getFieldConfiguration()](#getFieldConfiguration)
   * @see [getField()](#getField)
   */
  getFieldAlias(fieldName: string): string | null | undefined;
  /**
   * Returns the [FieldConfigurations](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/) for the specified field. The field configuration provides optional formatting and display information for the field.
   *
   * Previously, field formatting was commonly retrieved from [FeatureLayer.popupTemplate.fieldInfos[x].format](https://developers.arcgis.com/javascript/latest/references/core/popup/FieldInfo/#format). This is no longer needed, instead use [FeatureReductionBinning.getFieldConfiguration(fieldname).fieldFormat](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldConfiguration/#fieldFormat) to retrieve the field configuration formatting.
   *
   * @param fieldName - The name of the field.
   * @returns The field configuration of the specified field.
   * @since 5.0
   * @see [fieldConfigurations](#fieldConfigurations)
   * @see [getFieldAlias()](#getFieldAlias)
   * @see [getField()](#getField)
   */
  getFieldConfiguration(fieldName: string): FieldConfiguration | null | undefined;
}
declare const FeatureReductionBinningSuperclass: typeof Clonable & typeof JSONSupportMixin