import type VisualVariableLegendOptions from "./support/VisualVariableLegendOptions.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { VisualVariableType } from "../types.js";
import type { VisualVariableLegendOptionsProperties } from "./support/VisualVariableLegendOptions.js";

export interface VisualVariableProperties extends Partial<Pick<VisualVariable, "field" | "valueExpression" | "valueExpressionTitle">> {
  /**
   * An object providing options for displaying the visual variable in
   * the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
   */
  legendOptions?: VisualVariableLegendOptionsProperties | null;
}

/**
 * The visual variable base class. See each of the subclasses that extend this class
 * to learn how to create continuous data-driven thematic visualizations.
 *
 * [ColorVariable](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/ColorVariable/) | [SizeVariable](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/SizeVariable/) | [OpacityVariable](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/OpacityVariable/) | [RotationVariable](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/RotationVariable/)
 * ---------|----------|----------|---------
 * [![renderer-vv-color](https://developers.arcgis.com/javascript/latest/assets/img/samples/7-vv-color.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-color/) | [![renderer-vv-extrusion](https://developers.arcgis.com/javascript/latest/assets/img/samples/9-vv-size-3d.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-extrusion/) | [![renderer-vv-opacity](https://developers.arcgis.com/javascript/latest/assets/img/samples/12-vv-transparency.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-opacity/) | [![renderer-vv-rotation](https://developers.arcgis.com/javascript/latest/assets/img/samples/10-vv-rotation.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-rotation/)
 *
 * @since 4.10
 * @see [SimpleRenderer.visualVariables](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/#visualVariables)
 * @see [UniqueValueRenderer.visualVariables](https://developers.arcgis.com/javascript/latest/references/core/renderers/UniqueValueRenderer/#visualVariables)
 * @see [ClassBreaksRenderer.visualVariables](https://developers.arcgis.com/javascript/latest/references/core/renderers/ClassBreaksRenderer/#visualVariables)
 * @see [VectorFieldRenderer.visualVariables](https://developers.arcgis.com/javascript/latest/references/core/renderers/VectorFieldRenderer/#visualVariables)
 */
export default abstract class VisualVariable extends JSONSupport {
  /**
   * The name of the numeric attribute field that contains the data
   * values used to determine the color/opacity/size/rotation of each feature.
   */
  accessor field: string;
  /**
   * An object providing options for displaying the visual variable in
   * the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
   */
  get legendOptions(): VisualVariableLegendOptions | null | undefined;
  set legendOptions(value: VisualVariableLegendOptionsProperties | null | undefined);
  /** The visual variable type. */
  get type(): VisualVariableType | null | undefined;
  /**
   * An [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression following the specification
   * defined by the [Arcade Visualization Profile](https://developers.arcgis.com/javascript/latest/arcade/#visualization). Expressions
   * in visual variables may reference field values using the `$feature` profile variable and must return a number.
   *
   * The values returned from this expression are the data used to drive the visualization as defined in the stops.
   * This takes precedence over [field](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/VisualVariable/#field).
   * Therefore, this property is typically used as an alternative to [field](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/VisualVariable/#field) in visual variables.
   *
   * @see [Arcade - Visualization Profile](https://developers.arcgis.com/javascript/latest/arcade/#visualization)
   */
  accessor valueExpression: string | null | undefined;
  /**
   * The title identifying and describing the associated
   * [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression as defined in the [valueExpression](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/VisualVariable/#valueExpression) property. This is displayed
   * as the title of the corresponding visual variable in the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) in the absence of a
   * provided `title` in the [legendOptions](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/VisualVariable/#legendOptions) property.
   */
  accessor valueExpressionTitle: string | null | undefined;
}