import type { JSONSupport } from "../../core/JSONSupport.js";

export interface DimensionalDefinitionProperties extends Partial<Pick<DimensionalDefinition, "dimensionName" | "isSlice" | "values" | "variableName">> {}

/**
 * A dimensional definition defines a filter based on one variable and one dimension. You can filter multidimensional data with one or multiple dimensional slices. Instances of this class
 * are typically used when filtering data based on [slices](https://developers.arcgis.com/javascript/latest/references/core/layers/support/DimensionalDefinition/#isSlice) or ranges in one or more dimensions by setting
 * [MosaicRule.multidimensionalDefinition](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MosaicRule/#multidimensionalDefinition) on an [ImageryLayer.mosaicRule](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/#mosaicRule) or
 * the [ImageryTileLayer.multidimensionalDefinition](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/#multidimensionalDefinition) on an ImageryTileLayer.
 *
 * For example, a single ImageryLayer may have a `depth` dimension storing sea temperatures for the same pixel location at various depths. Another dimension
 * could be `time` where the same pixel stores multiple values based on a window of time.
 *
 * The snippet in the image below renders sea temperature at the surface for a specific time in the year.
 *
 * ```js
 * let multidimensionalDefinition = [];
 * multidimensionalDefinition.push(new DimensionalDefinition({
 *   variableName: "water_temp",
 *   dimensionName: "StdZ", // water depth
 *   values: [0], // sea surface or 0ft
 *   isSlice: true
 * }));
 *
 * let mosaicRule = new MosaicRule();
 * mosaicRule.multidimensionalDefinition = multidimensionalDefinition;
 * ```
 *
 * [![layers-imagery-dd-0](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/imagery/layers-imagery-dd-0.png)](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-pixelvalues/)
 *
 * In contrast, the following image renders sea temperature data from the same service
 * at 5000 meters below the surface within the same time window.
 *
 * ```js
 * let multidimensionalDefinition = [];
 * multidimensionalDefinition.push(new DimensionalDefinition({
 *   variableName: "water_temp",
 *   dimensionName: "StdZ", // water depth
 *   values: [-5000], // 5000 m below
 *   isSlice: true
 * }));
 *
 * let mosaicRule = new MosaicRule();
 * mosaicRule.multidimensionalDefinition = multidimensionalDefinition;
 * ```
 *
 * [![layers-imagery-dd-5000](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/imagery/layers-imagery-dd-5000.png)](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-pixelvalues/)
 *
 * @since 4.0
 * @see [ImageryLayer - working with multidimensional raster data](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/#multidimensionaldata)
 * @see [ImageryTileLayer - working with multidimensional raster data](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/#multidimensionaldata)
 * @see [MosaicRule](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MosaicRule/)
 * @see [Sample - Work with pixelFilter in an ImageryLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-pixelvalues/)
 * @see [Sample - Multidimensional ImageryTileLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-multidimensional/)
 */
export default class DimensionalDefinition extends JSONSupport {
  constructor(properties?: DimensionalDefinitionProperties);
  /** The dimension associated with the variable. */
  accessor dimensionName: string;
  /**
   * Indicates whether the values indicate slices (rather than ranges).
   *
   * @default false
   */
  accessor isSlice: boolean;
  /**
   * An array of single values or tuples [min, max] each defining a range of
   * valid values along the specified dimension.
   *
   * @example
   * // -10 is the minimum valid value and 10 is the maximum valid value
   * definition.values = [[-10, 10]];
   */
  accessor values: (number | [
      number,
      number
  ])[];
  /** The required variable name by which to filter. */
  accessor variableName: string;
  /**
   * Creates a clone of the DimensionalDefinition object.
   *
   * @returns A clone of the object that invoked this method.
   * @example
   * // Creates a clone of the DimensionalDefinition
   * let dimensionalDefinition1 = dimensionalDefinition.clone();
   */
  clone(): DimensionalDefinition;
}