import type Extent from "../../geometry/Extent.js";
import type Point from "../../geometry/Point.js";
import type Polygon from "../../geometry/Polygon.js";
import type MosaicRule from "../../layers/support/MosaicRule.js";
import type RasterFunction from "../../layers/support/RasterFunction.js";
import type TimeExtent from "../../time/TimeExtent.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { PolygonProperties } from "../../geometry/Polygon.js";
import type { ExtentProperties } from "../../geometry/Extent.js";
import type { MosaicRuleProperties } from "../../layers/support/MosaicRule.js";
import type { RasterFunctionProperties } from "../../layers/support/RasterFunction.js";
import type { PointProperties } from "../../geometry/Point.js";
import type { TimeExtentProperties } from "../../time/TimeExtent.js";

export interface ImageHistogramParametersProperties {
  /**
   * Input geometry that defines the area of interest for which the histograms and statistics will be computed.
   * The geometry can be an [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) or a [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html).
   */
  geometry?: (ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" }) | null;
  /**
   * Specifies the [mosaic rule](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-MosaicRule.html) on how individual images should be mosaicked
   * when the histogram is computed. When a mosaic rule is not specified, the current settings on the [ImageryLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html) will be used.
   */
  mosaicRule?: MosaicRuleProperties | null;
  /**
   * Specifies the pixel size (or the resolution). If pixel size is not specified, `pixelSize` will default to the base resolution of the image service.
   * The raster at the specified pixel size in the mosaic dataset will be used for the histogram calculation.
   *
   * @example
   * // set the pixel size parameter to match the current
   * // resolution of the view and spatial reference
   * let pixelSize = {
   *   x:view.resolution,
   *   y:view.resolution,
   *   spatialReference: view.spatialReference
   * }
   * // set the histogram parameters to request
   * // data for the current view extent and resolution
   * let params = new ImageHistogramParameters({
   *   geometry:  view.extent,
   *   pixelSize: pixelSize
   * });
   *
   * // request for histograms for the specified parameters
   * layer.computeHistograms(params).then((results) =>{
   *   // results are returned and process it as needed.
   *   console.log("histograms", result);
   * })
   * .catch(function(err){
   *   console.log("err", err)
   * });
   */
  pixelSize?: PointProperties;
  /**
   * Specifies the [raster function](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RasterFunction.html) from which to compute the statistics and histogram.
   * The rasterFunction defines how the image should be processed.  When a renderingRule is not specified, the current
   * settings on the [ImageryLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html) will be used.
   *
   * @since 4.27
   */
  rasterFunction?: RasterFunctionProperties | null;
  /**
   * The [time extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html) for which to compute the statistics and histogram.
   * The time parameter is supported at ArcGIS Server 10.8 and later.
   */
  timeExtent?: TimeExtentProperties | null;
}

/**
 * Input parameters for the [ImageryLayer.computeHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#computeHistograms) or
 * [ImageryLayer.computeStatisticsHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#computeStatisticsHistograms)
 * method on [ImageryLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html), or the [ImageryTileLayer.computeStatisticsHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html#computeStatisticsHistograms)
 * method on [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html).
 *
 * @since 4.20
 * @see [ImageryLayer.computeHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#computeHistograms)
 * @see [ImageryLayer.computeStatisticsHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#computeStatisticsHistograms)
 * @see [ImageryTileLayer.computeStatisticsHistograms()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html#computeStatisticsHistograms)
 */
export default class ImageHistogramParameters extends JSONSupport {
  constructor(properties?: ImageHistogramParametersProperties);
  /**
   * Input geometry that defines the area of interest for which the histograms and statistics will be computed.
   * The geometry can be an [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) or a [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html).
   */
  get geometry(): Extent | Polygon | null | undefined;
  set geometry(value: (ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" }) | null | undefined);
  /**
   * Specifies the [mosaic rule](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-MosaicRule.html) on how individual images should be mosaicked
   * when the histogram is computed. When a mosaic rule is not specified, the current settings on the [ImageryLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html) will be used.
   */
  get mosaicRule(): MosaicRule | null | undefined;
  set mosaicRule(value: MosaicRuleProperties | null | undefined);
  /**
   * Specifies the pixel size (or the resolution). If pixel size is not specified, `pixelSize` will default to the base resolution of the image service.
   * The raster at the specified pixel size in the mosaic dataset will be used for the histogram calculation.
   *
   * @example
   * // set the pixel size parameter to match the current
   * // resolution of the view and spatial reference
   * let pixelSize = {
   *   x:view.resolution,
   *   y:view.resolution,
   *   spatialReference: view.spatialReference
   * }
   * // set the histogram parameters to request
   * // data for the current view extent and resolution
   * let params = new ImageHistogramParameters({
   *   geometry:  view.extent,
   *   pixelSize: pixelSize
   * });
   *
   * // request for histograms for the specified parameters
   * layer.computeHistograms(params).then((results) =>{
   *   // results are returned and process it as needed.
   *   console.log("histograms", result);
   * })
   * .catch(function(err){
   *   console.log("err", err)
   * });
   */
  get pixelSize(): Point;
  set pixelSize(value: PointProperties);
  /**
   * Specifies the [raster function](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RasterFunction.html) from which to compute the statistics and histogram.
   * The rasterFunction defines how the image should be processed.  When a renderingRule is not specified, the current
   * settings on the [ImageryLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html) will be used.
   *
   * @since 4.27
   */
  get rasterFunction(): RasterFunction | null | undefined;
  set rasterFunction(value: RasterFunctionProperties | null | undefined);
  /**
   * The [time extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html) for which to compute the statistics and histogram.
   * The time parameter is supported at ArcGIS Server 10.8 and later.
   */
  get timeExtent(): TimeExtent | null | undefined;
  set timeExtent(value: TimeExtentProperties | null | undefined);
}