import type SpatialReference from "../geometry/SpatialReference.js";
import type ClassBreaksRenderer from "./ClassBreaksRenderer.js";
import type DictionaryRenderer from "./DictionaryRenderer.js";
import type DotDensityRenderer from "./DotDensityRenderer.js";
import type HeatmapRenderer from "./HeatmapRenderer.js";
import type PieChartRenderer from "./PieChartRenderer.js";
import type SimpleRenderer from "./SimpleRenderer.js";
import type UniqueValueRenderer from "./UniqueValueRenderer.js";
import type ColorVariable from "./visualVariables/ColorVariable.js";
import type OpacityVariable from "./visualVariables/OpacityVariable.js";
import type RotationVariable from "./visualVariables/RotationVariable.js";
import type SizeVariable from "./visualVariables/SizeVariable.js";
import type { AbortOptions } from "../core/promiseUtils.js";
import type { WebStyleAcceptedFormat } from "../symbols/support/types.js";

/** @since 5.0 */
export type RendererType = RendererUnion["type"];

/** @since 5.0 */
export type NormalizationType = "field" | "log" | "percent-of-total" | "natural-log" | "square-root";

/** @since 5.0 */
export type ClassificationMethod = "equal-interval" | "manual" | "natural-breaks" | "quantile" | "standard-deviation" | "defined-interval";

/** @since 5.0 */
export type SizeVariableAxis = "width" | "depth" | "height" | "width-and-depth" | "all";

/** @since 5.0 */
export type SizeVariableRepresentation = "radius" | "diameter" | "area" | "width" | "distance";

/** @since 5.0 */
export type SizeVariableUnit = "unknown" | "inches" | "feet" | "yards" | "miles" | "nautical-miles" | "millimeters" | "centimeters" | "decimeters" | "meters" | "kilometers";

/** @since 5.0 */
export type VisualVariable = ColorVariable | SizeVariable | OpacityVariable | RotationVariable;

/** @since 5.0 */
export type VisualVariableType = VisualVariable["type"];

/** @since 5.0 */
export interface VisualVariableLegendOptions {
  /**
   * The title used to represent the age size ramp in the
   *   [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
   *
   * @since 5.0
   */
  title?: string | null;
  /**
   * Indicates if the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) should display content
   *   describing the generated renderer.
   *
   * @since 5.0
   */
  showLegend?: boolean;
}

/** @since 5.0 */
export interface GetSymbolOptions extends AbortOptions {
  /**
   * The [view scale](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#scale) at which the graphic is displayed.
   *
   * @since 5.0
   */
  scale?: number | null;
  /**
   * The [SceneView.viewingMode](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#viewingMode) of the view, if the graphic
   *   is displayed in a SceneView.
   *
   * @since 5.0
   */
  viewingMode?: string | null;
  /**
   * The spatial reference of the view in which the graphic
   *   is displayed.
   *
   * @since 5.0
   */
  spatialReference?: SpatialReference | null;
}

/** @since 5.0 */
export interface GetVisualVariableValuesOptions extends GetSymbolOptions {
  /**
   * The [MapView.resolution](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#resolution) of the view at which
   *   the graphic is displayed.
   *
   * @since 5.0
   */
  resolution?: number;
}

/** @since 5.0 */
export interface GetDisplaySymbolOptions extends GetVisualVariableValuesOptions {
  /**
   * The renderer of the layer associated with the `graphic`.
   *
   * @since 5.0
   */
  renderer?: RendererUnion;
  /**
   * A list of accepted formats when
   *   resolving web style symbols. The symbol will resolve to the first accepted format in the list.
   *
   * @default ["web", "cim"]
   * @since 5.0
   */
  webStyleAcceptedFormats?: WebStyleAcceptedFormat[];
}

/** @since 5.0 */
export type VectorFieldStyles = "beaufort-ft" | "beaufort-km" | "beaufort-kn" | "beaufort-m" | "beaufort-mi" | "classified-arrow" | "ocean-current-kn" | "ocean-current-m" | "simple-scalar" | "single-arrow" | "wind-barb";

/** @since 5.0 */
export type RelationshipNumClasses = 2 | 3 | 4;

/** @since 5.0 */
export type DictionaryUserConfig = Object;

/** @since 5.0 */
export type DictionaryFieldMap = Record<string, string>;

/** @since 5.0 */
export interface DictionaryConfigItem {}

/**
 * Union of all renderers with visual variables.
 *
 * @since 5.0
 */
export type RendererWithVisualVariablesUnion = SimpleRenderer | ClassBreaksRenderer | UniqueValueRenderer | DotDensityRenderer | DictionaryRenderer | PieChartRenderer;

/**
 * Union of renderers.
 *
 * @since 5.0
 */
export type RendererUnion = RendererWithVisualVariablesUnion | HeatmapRenderer;