import type Color from "../../Color.js";
import type ColorRamp from "./ColorRamp.js";
import type { ColorRampProperties } from "./ColorRamp.js";
import type { ColorRampAlgorithmType } from "./types.js";
import type { ColorLike } from "../../Color.js";

export interface AlgorithmicColorRampProperties extends ColorRampProperties, Partial<Pick<AlgorithmicColorRamp, "algorithm">> {
  /** The first color in the color ramp. */
  fromColor?: ColorLike;
  /** The last color in the color ramp. */
  toColor?: ColorLike;
}

/**
 * Creates a color ramp for use in a raster renderer. The algorithmic color ramp is defined by specifying
 * two colors and the algorithm used to traverse the intervening color spaces.
 *
 * There are three algorithms that can be used to define the color values between the from and to colors: 'cie-lab', 'hsv', and 'lab-lch'.
 * There is very little difference between these algorithms when the from and the to colors are of the same or very similar hues. However,
 * when the hues for the from and to colors are different (Hue is different by 40 or more on a 0-360 scale), the algorithms produce different
 * results. The 'hsv' algorithm traverses the hue difference in a purely linear fashion, resulting in a bright ramp where all intermediate colors
 * are represented. For instance, a ramp from red to green would include orange, yellow, and yellow-green. The 'cie-lab' and 'lab-lch' produce a
 * more blended result. Thus, a ramp from dark green to orange would not contain a bright yellow, but instead a more brown and green-gold or
 * green-brown intermediate color. The advantage of the 'cie-lab' algorithm is that the colors of the ramp are visually equidistant,
 * which can produce a better ramp.
 *
 * @since 4.20
 */
export default class AlgorithmicColorRamp extends ColorRamp {
  constructor(properties?: AlgorithmicColorRampProperties);
  /**
   * The algorithm used to generate the colors between the `fromColor` and `toColor`. Each algorithm uses different methods for
   * generating the intervening colors.
   *
   * Possible Value | Description
   * ---------------|------------
   * cie-lab | Blends the from and to colors without traversing the intervening hue space.
   * lab-lch | The hue, saturation, value (hsv) algorithm is a linear traverse of colors between pairs: Color 1 H to Color 2 H, Color 1 S to Color 2 S, and Color 1 V to Color 2 V.
   * hsv | The lab-lch algorithm is very similar to the cie-lab but does not seek the shortest path between colors.
   */
  algorithm?: ColorRampAlgorithmType | null;
  /** The first color in the color ramp. */
  get fromColor(): Color;
  set fromColor(value: ColorLike);
  /** The last color in the color ramp. */
  get toColor(): Color;
  set toColor(value: ColorLike);
  /**
   * A string value representing the color ramp type.
   *
   * @default "algorithmic"
   */
  get type(): "algorithmic";
  /**
   * Creates a deep clone of this object.
   *
   * @returns A deep clone of the [AlgorithmicColorRamp](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AlgorithmicColorRamp.html) instance that
   * invoked this method.
   */
  clone(): AlgorithmicColorRamp;
}