import type ColorSizeStop from "../../../renderers/visualVariables/support/ColorSizeStop.js";
import type SizeStop from "../../../renderers/visualVariables/support/SizeStop.js";
import type SmartMappingPrimaryHandleSliderViewModel from "../SmartMappingPrimaryHandleSliderViewModel.js";
import type { SmartMappingPrimaryHandleSliderViewModelProperties } from "../SmartMappingPrimaryHandleSliderViewModel.js";

export interface SizeSliderViewModelProperties<StopType extends SupportedStops = SupportedStops> extends SmartMappingPrimaryHandleSliderViewModelProperties, Partial<Pick<SizeSliderViewModel<StopType>, "persistSizeRangeEnabled" | "stops">> {}

export type SupportedStops = SizeStop | ColorSizeStop;

/**
 * Provides the logic for the [SizeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/smartMapping/SizeSlider/) widget.
 *
 * @since 4.12
 * @see [SizeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/smartMapping/SizeSlider/)
 */
export default class SizeSliderViewModel<StopType extends SupportedStops = SupportedStops> extends SmartMappingPrimaryHandleSliderViewModel<StopType> {
  constructor(properties?: SizeSliderViewModelProperties);
  /**
   * This property is typically used in diverging, or `above-and-below` renderer configurations.
   *
   * When `true`, ensures symbol sizes in the `above` range
   * are consistent with symbol sizes in the `below` range for all slider thumb positions.
   * In other words, the size values in the [stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/smartMapping/SizeSlider/SizeSliderViewModel/#stops) will adjust
   * proportionally according to the positions of the data values within the
   * constraints of the size range (maxSize - minSize) as the slider thumbs update.
   * When `false`, size values in the stops will remain the same even when slider thumb values
   * change.
   *
   * In most cases, this should be set to `true` to keep sizes in the `above` range consistent with
   * sizes in the `below` range to avoid map misinterpretation.
   *
   * @default false
   * @since 4.19
   * @example slider.viewModel.persistSizeRangeEnabled = true;
   */
  accessor persistSizeRangeEnabled: boolean;
  /**
   * The size stops from the [SizeVariable](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/SizeVariable/)
   * to link to the slider.
   *
   * @example
   * sizeRendererCreator.createContinuousRenderer({
   *   layer: featureLayer,
   *   field: "fieldName",
   *   basemap: "gray-vector"
   * }).then(function(sizeResponse){
   *   const slider = new SizeSlider({
   *     viewModel: new SizeSliderVM({
   *       stops: sizeResponse.visualVariable.stops
   *     }),
   *     container: "sliderDiv"
   *   });
   * });
   */
  accessor stops: StopType[];
}