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

export interface SizeStopProperties extends Partial<Pick<SizeStop, "label" | "value">> {
  /**
   * The size value in points (between `0` and `90`) used to render features with the given [value](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-visualVariables-support-SizeStop.html#value).
   * This value may also be autocast from a string in points or pixels.
   *
   * @example
   * // size defined in points
   * const sizeVisVar = {
   *   type: "size",
   *   field: "POPULATION",
   *   stops: [
   *     { value: 5000, size: 4 },
   *     { value: 1000000, size: 80 }
   *   ]
   * };
   * renderer.visualVariables = [ sizeVisVar ];
   * @example
   * // size defined with pixels
   * const sizeVisVar = {
   *   type: "size",
   *   field: "POPULATION",
   *   stops: [
   *     { value: 5000, size: "6px" },
   *     { value: 1000000, size: "120px" }
   *   ]
   * };
   * renderer.visualVariables = [ sizeVisVar ];
   */
  size?: number | string;
}

/**
 * Defines a size stop used for creating a continuous size visualization in a
 * [size visual variable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-visualVariables-SizeVariable.html#stops).
 *
 * @since 4.10
 * @see [SizeVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-visualVariables-SizeVariable.html)
 */
export default class SizeStop extends JSONSupport {
  constructor(properties?: SizeStopProperties);
  /** A string value used to label the stop in the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-legend/). */
  accessor label: string | null | undefined;
  /**
   * The size value in points (between `0` and `90`) used to render features with the given [value](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-visualVariables-support-SizeStop.html#value).
   * This value may also be autocast from a string in points or pixels.
   *
   * @example
   * // size defined in points
   * const sizeVisVar = {
   *   type: "size",
   *   field: "POPULATION",
   *   stops: [
   *     { value: 5000, size: 4 },
   *     { value: 1000000, size: 80 }
   *   ]
   * };
   * renderer.visualVariables = [ sizeVisVar ];
   * @example
   * // size defined with pixels
   * const sizeVisVar = {
   *   type: "size",
   *   field: "POPULATION",
   *   stops: [
   *     { value: 5000, size: "6px" },
   *     { value: 1000000, size: "120px" }
   *   ]
   * };
   * renderer.visualVariables = [ sizeVisVar ];
   */
  get size(): number;
  set size(value: number | string);
  /** Specifies the data value to map to the given [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-visualVariables-support-SizeStop.html#size). */
  accessor value: number;
  /**
   * Creates a deep clone of the SizeStop.
   *
   * @returns A deep clone of the size
   *   stop that invoked this method.
   * @example
   * // Creates a deep clone of the visual variable
   * const stops = renderer.visualVariables[0].stops.map(function(stop){
   *   return stop.clone();
   * });
   */
  clone(): SizeStop;
}