/**
 * This object contains helper methods for generating popup templates to be set on
 * a layer's [FeatureReductionCluster.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/#popupTemplate).
 * The suggested popup templates will include summary information about features in the cluster based on the
 * layer's renderer. For example, in a layer visualizing population, the cluster popup template will include
 * the number of features in the cluster and the average population of features in the cluster.
 *
 * ![clustering-generated-popup](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/clustering/clustering-generated-popup.png)
 *
 * For layers with
 * a [UniqueValueRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/UniqueValueRenderer/), the popup will include the predominant unique value info
 * of features in the cluster.
 *
 * [![clustering-types-popup](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/clustering/clustering-types-popup.png)](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster-filter/)
 *
 * This module only applies to layers with a point geometry type.
 *
 * @since 4.16
 * @see [FeatureReductionCluster.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/#popupTemplate)
 * @see [Sample - Point clustering - generate suggested configuration](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster-filter/)
 */
import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
import type SubtypeSublayer from "../../layers/support/SubtypeSublayer.js";
import type { RendererWithVisualVariablesUnion } from "../../renderers/types.js";
import type { PopupSupportedLayer } from "../types.js";
import type { Templates } from "./types.js";

/**
 * Returns one or more suggested default [popupTemplates](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) for a given
 * layer's [FeatureReductionCluster.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/#popupTemplate)
 * configuration. The cluster popup will contain  information describing features in the cluster, including
 * the number of features in the cluster and summary statistics based on fields and expressions used in
 * the layer's renderer.
 *
 * @param parameters - The function parameters.
 * @returns Returns an object containing suggested primary
 *   and secondary PopupTemplates for the input layer's `featureReduction` property.
 * @example
 * // Sets a suggested popupTemplate on the layer's clusters
 * clusterPopupTemplateCreator.getTemplates({
 *   layer: featureLayer,
 *   renderer: featureLayer.renderer
 * }).then(function(popupTemplateResponse){
 *   const featureReduction = featureLayer.featureReduction.clone();
 *   featureReduction.popupTemplate = popupTemplateResponse.primaryTemplate.value;
 *   featureLayer.featureReduction = featureReduction;
 * }).catch(function(error){
 *   console.error(error);
 * });
 */
export function getTemplates(parameters: TemplateParameters): Promise<Templates | null | undefined>;

export interface TemplateParameters {
  /**
   * Specify the renderer to be used on the layer when
   *   `featureReduction` is enabled if it will be different than the renderer already set on the layer.
   */
  renderer: RendererWithVisualVariablesUnion;
  /** The point layer that is or will be clustered. */
  layer: Exclude<PopupSupportedLayer, SubtypeGroupLayer | SubtypeSublayer>;
}