import type Extent from "../../geometry/Extent.js";
import type Point from "../../geometry/Point.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { ExtentProperties } from "../../geometry/Extent.js";
import type { PointProperties } from "../../geometry/Point.js";

export interface AddressCandidateProperties extends Partial<Pick<AddressCandidate, "address" | "attributes" | "score">> {
  /** The minimum and maximum X and Y coordinates of a bounding box of the address candidate. */
  extent?: ExtentProperties | null;
  /**
   * The [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) object representing the location of the
   * [address](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AddressCandidate.html#address).
   */
  location?: PointProperties | null;
}

/**
 * Represents the result of a geocode service operation as a list of address candidates.
 * This resource provides information about candidates, including the address, location, and match score.
 *
 * @since 4.20
 * @see [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html)
 * @see [Find Address Candidates](https://developers.arcgis.com/rest/services-reference/enterprise/find-address-candidates.htm)
 */
export default class AddressCandidate extends JSONSupport {
  constructor(properties?: AddressCandidateProperties);
  /** Address of the candidate. */
  accessor address: string | null | undefined;
  /**
   * Name value pairs of field name and field value as defined in `outFields`
   * in [addressToLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html#addressToLocations).
   */
  accessor attributes: Object | null | undefined;
  /** The minimum and maximum X and Y coordinates of a bounding box of the address candidate. */
  get extent(): Extent | null | undefined;
  set extent(value: ExtentProperties | null | undefined);
  /**
   * The [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) object representing the location of the
   * [address](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AddressCandidate.html#address).
   */
  get location(): Point | null | undefined;
  set location(value: PointProperties | null | undefined);
  /**
   * Numeric score between `0` and `100` for geocode candidates. A candidate with a score
   * of `100` means a perfect match, and `0` means no match.
   */
  accessor score: number | null | undefined;
}