import type SizeStop from "../visualVariables/support/SizeStop.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { AuthoringInfoVisualVariableThemes, AuthoringInfoVisualVariableUnits, ReferenceSizeSymbolStyle, SpikeSymbolStyle, AuthoringInfoVisualVariableStyles, AuthoringInfoVisualVariableTypes } from "./types.js";
import type { SizeStopProperties } from "../visualVariables/support/SizeStop.js";

export interface AuthoringInfoVisualVariableProperties extends Partial<Pick<AuthoringInfoVisualVariable, "endTime" | "field" | "maxSliderValue" | "minSliderValue" | "normalizationField" | "referenceSizeScale" | "referenceSizeSymbolStyle" | "spikeSymbolStyle" | "startTime" | "style" | "theme" | "type" | "units">> {
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size` or `spike`. An array of objects that defines
   * the thematic size ramp for reference-size or spike visualization. At least two
   * stops are required. The stops must be listed in ascending order based on the value of the value property
   * in each stop. This property is required when theme is `reference-size` or `spike` for the legend to properly
   * render the size reference or spike symbol style along with its labels.
   *
   * @since 4.30
   */
  sizeStops?: SizeStopProperties[] | null;
}

/**
 * Contains authoring properties of visual variables generated from
 * one of the Smart Mapping methods or sliders.
 *
 * @since 4.6
 * @see [Sample - Multivariate data exploration](https://developers.arcgis.com/javascript/latest/sample-code/visualization-sm-multivariate/)
 * @see [Web map specification - AuthoringInfo visual variable](https://developers.arcgis.com/web-map-specification/objects/authoringInfo_visualVariable/)
 */
export default class AuthoringInfoVisualVariable extends JSONSupport {
  constructor(properties?: AuthoringInfoVisualVariableProperties);
  /**
   * If an age or timeline renderer was generated, indicates the end
   * time of the visualization.
   */
  accessor endTime: string | number | null | undefined;
  /**
   * Indicates the field name used for generating the data-driven visualization. Applies to age renderer or
   * reference size visualizations (i.e. when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size`).
   * This property is used for UI purposes only.
   */
  accessor field: string | null | undefined;
  /** Indicates the value of the upper handle if a slider was used to generate the visual variable. */
  accessor maxSliderValue: number | null | undefined;
  /** Indicates the value of the lower handle if a slider was used to generate the visual variable. */
  accessor minSliderValue: number | null | undefined;
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size`. Indicates the attribute
   * field the user chose in the Smart Mapping gallery for normalizing data in the selected field.
   * This property is used for UI purposes only.
   *
   * @since 4.30
   */
  accessor normalizationField: string | null | undefined;
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size`. This value indicates
   * the reference scale used in a reference size visualization and must be generated as part of
   * the [createContinuousRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-size.html#createContinuousRenderer)
   * or [updateRendererWithReferenceSize()](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-size.html#updateRendererWithReferenceSize) methods.
   *
   * When defined, the reference scale ensures the reference size symbols scale in size as the user zooms
   * in and out in the view. This ensures symbols remain coincident to one another and avoid overlapping.
   *
   * @since 4.30
   */
  accessor referenceSizeScale: number | null | undefined;
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size`. This value specifies
   * the style (or shape) of the symbols generated with a reference line. Typically, a reference line
   * is used to visualize the maximum possible size (i.e. data value) of a data-driven proportional symbol.
   * Visualizations with a reference size must be defined in a
   * [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html) or [UniqueValueRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html)
   * with a [CIMSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-CIMSymbol.html) containing two symbol layers:
   * one visualizing the maximum size of the symbol as a hollow ring, and the other as a solid
   * shape whose size is driven by a data value set in the renderer's field property, and configured
   * in a primitive override of the CIMSymbol. These renderers must not contain size visual variables,
   * but may contain other visual variable types. This property is used for UI purposes only. When defined,
   * [sizeStops](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#sizeStops) must also be defined for the legend to properly represent the
   * visualization.
   *
   * @since 4.30
   */
  accessor referenceSizeSymbolStyle: ReferenceSizeSymbolStyle | null | undefined;
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `reference-size` or `spike`. An array of objects that defines
   * the thematic size ramp for reference-size or spike visualization. At least two
   * stops are required. The stops must be listed in ascending order based on the value of the value property
   * in each stop. This property is required when theme is `reference-size` or `spike` for the legend to properly
   * render the size reference or spike symbol style along with its labels.
   *
   * @since 4.30
   */
  get sizeStops(): SizeStop[] | null | undefined;
  set sizeStops(value: SizeStopProperties[] | null | undefined);
  /**
   * Only applicable when [theme](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#theme) is `spike`. This value specifies
   * the style (or shape) of the symbols generated with a spike renderer.
   * Visualizations with a spike size must be defined in a
   * [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html) or [UniqueValueRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html)
   * with a [CIMSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-CIMSymbol.html). These renderers must not contain size visual variables,
   * but may contain other visual variable types. This property is used for UI purposes only. When defined,
   * [sizeStops](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfoVisualVariable.html#sizeStops) must also be defined for the legend to properly represent the
   * visualization.
   *
   * @since 4.33
   */
  accessor spikeSymbolStyle: SpikeSymbolStyle | null | undefined;
  /**
   * If an age or timeline renderer was generated, indicates the start
   * time of the visualization.
   */
  accessor startTime: string | number | null | undefined;
  /**
   * If the UI offers the option to display values based on a ratio or
   * percentage, this indicates which selection was made.
   */
  accessor style: AuthoringInfoVisualVariableStyles | null | undefined;
  /**
   * Indicates the theme selected by the user when generating a renderer
   * or visual variable with one of the Smart Mapping functions.
   */
  accessor theme: AuthoringInfoVisualVariableThemes | null | undefined;
  /** The type of visual variable generated. */
  accessor type: AuthoringInfoVisualVariableTypes | null | undefined;
  /** If an age or timeline renderer was generated, indicates the time units used. */
  accessor units: AuthoringInfoVisualVariableUnits | null | undefined;
  /**
   * Creates a deep clone of the instance.
   *
   * @returns A deep clone of the object that
   * invoked this method.
   * @example
   * // Creates a deep clone of the authoring info visual variable
   * let authInfoVV = layer.renderer.authoringInfo.visualVariables.find(function(vv){
   *   return vv.type === "color";
   * }).clone();
   */
  clone(): AuthoringInfoVisualVariable;
}