import type RasterFunction from "../../support/RasterFunction.js";
import type { RasterPixelType } from "../types.js";

/**
 * Raster argument used to specify raster(s) used in raster processing.
 *
 * @since 4.28
 */
export type RasterPrimaryArgument = string | RasterFunction;

/**
 * Raster argument used to specify raster(s) used in raster processing.
 * When the input raster is the image service itself and if the raster function takes:
 * * A single input raster: the raster parameter can be omitted.
 * * Multiple input rasters: the image service raster needs to be represented using [defaultRaster](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#defaultRaster) as `("$$")`.
 *
 * When the input raster is the result of a another raster function processing:
 * * Set the raster parameter to a result of a raster function.
 *
 * When the raster function takes more than one input rasters:
 * * One of the input (usually the first) must be either another raster function or an image service raster
 * * Additional rasters can also be specified in the form of a scalar, e.g. 100.
 * When the function is applied on a dynamic image service:
 * * `$RasterId` (e.g. "$1") can be used to reference a raster by its objectId.
 *
 * @since 4.28
 */
export type RasterArgument = number | RasterPrimaryArgument;

export type ChangeMethod = "difference" | "relative-difference" | "categorical" | "euclidean-distance" | "angle-difference" | "band-with-most-change";

/**
 * Input parameters for performing math operations on one input raster.
 *
 * @since 4.28
 */
export interface BaseRasterFunctionParameters {
  /**
   * The output pixel type, default is `unknown`.
   *
   * @default "unknown"
   */
  outputPixelType?: RasterPixelType;
  /** The input raster. Default is the image service. */
  raster?: RasterPrimaryArgument;
}

/**
 * Input parameters for perform math operations between two rasters.
 *
 * @since 4.28
 */
export interface Base2RasterFunctionParameters {
  /** The output pixel type, default is unknown. */
  outputPixelType?: RasterPixelType;
  /** The first raster (pre changes). */
  raster: RasterArgument;
  /** The second raster (post changes). */
  raster2: RasterArgument;
}

export interface BaseNRasterFunctionParameters {
  /**
   * The output pixel type, default is unknown.
   *
   * @default "unknown"
   */
  outputPixelType?: RasterPixelType;
  /** The input raster. Default is the image service. */
  rasters: RasterArgument[];
}