import type Point from "../../geometry/Point.js";
import type { Clonable, ClonableMixinProperties } from "../../core/Clonable.js";
import type { ScreenPoint } from "../../core/types.js";
import type { PointProperties } from "../../geometry/Point.js";

/**
 * A control point object in the [ControlPointsGeoreference#controlPoints](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-ControlPointsGeoreference.html#controlPoints) array.
 * A control point is composed of a [ScreenPoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-types.html#ScreenPoint) representing a point on the element and of a [mapPoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) to map
 * the location of the [ScreenPoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-types.html#ScreenPoint) in the map space.
 *
 * @since 4.25
 * @example
 * const controlPoint = {
 *   sourcePoint: { x: 0, y: 0 },
 *   mapPoint: new Point({ x: -180, y: 85 })
 * };
 */
export interface ControlPointProperties extends ClonableMixinProperties, Partial<Pick<ControlPoint, "sourcePoint">> {
  /** The coordinate of the the control point in the map coordinate space. */
  mapPoint?: PointProperties | null;
}

export default class ControlPoint extends Clonable {
  constructor(properties?: ControlPointProperties);
  /** The coordinate of the the control point in the map coordinate space. */
  get mapPoint(): Point | null | undefined;
  set mapPoint(value: PointProperties | null | undefined);
  /** The coordinate of the control point in the image coordinate space in pixels. */
  accessor sourcePoint: ScreenPoint | null | undefined;
}

export type ControlPoints = [
    ControlPoint,
    ControlPoint
] | [
    ControlPoint,
    ControlPoint,
    ControlPoint
] | [
    ControlPoint,
    ControlPoint,
    ControlPoint,
    ControlPoint
];