import type Accessor from "../../../core/Accessor.js";
import type Format from "./Format.js";
import type { Position } from "../../types.js";
import type { FormatProperties } from "./Format.js";

export interface ConversionProperties extends Partial<Pick<Conversion, "position">> {
  /**
   * The [Format](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Format/) for this conversion.  The Format contains information
   * detailing how the Conversion should be performed and how it will be displayed.
   *
   * @since 4.7
   */
  format?: FormatProperties | null;
}

/**
 * The Conversion class represents one of the [CoordinateConversion.conversions](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/#conversions)
 * in the [Coordinate Conversion widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/).  Each conversion is represented by a row
 * in the widget.
 *
 * @since 4.7
 * @see [CoordinateConversion](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/)
 * @see [CoordinateConversionViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/CoordinateConversionViewModel/)
 * @see [Format](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Format/)
 * @see [Sample - Add custom coordinate formats](https://developers.arcgis.com/javascript/latest/sample-code/widgets-coordinateconversion-custom/)
 */
export default class Conversion extends Accessor {
  /**
   * @example
   * const ccWidget = new CoordinateConversion({
   *    view: view
   * });
   *
   * const newFormat = new Format({
   *    // add new conversion format here
   * });
   *
   * // add our new format to the widget's dropdown
   * ccWidget.formats.add(newFormat);
   *
   * const newConversion = new Conversion({
   *    format: newFormat
   * });
   *
   * // add the custom format to the top of the widget's display
   * ccWidget.conversions.splice(0, newConversion);
   */
  constructor(properties?: ConversionProperties);
  /**
   * A formatted string based on the current [position](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Conversion/#position) and display information on the [format](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Conversion/#format).
   *
   * @since 4.7
   */
  get displayCoordinate(): string | null | undefined;
  /**
   * The [Format](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Format/) for this conversion.  The Format contains information
   * detailing how the Conversion should be performed and how it will be displayed.
   *
   * @since 4.7
   */
  get format(): Format | null | undefined;
  set format(value: FormatProperties | null | undefined);
  /**
   * The position property contains the location information for this conversion.
   *
   * @since 4.7
   */
  accessor position: Position | null | undefined;
}