import type Point from "../../geometry/Point.js";
import type SpatialReference from "../../geometry/SpatialReference.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { LocationType } from "../types.js";
import type { GeocodeFeatureType, GeocodePreferredLabel } from "./types.js";
import type { PointProperties } from "../../geometry/Point.js";
import type { SpatialReferenceProperties } from "../../geometry/SpatialReference.js";

/** @since 5.0 */
export interface LocationToAddressParametersProperties extends Partial<Pick<LocationToAddressParameters, "apiKey" | "featureTypes" | "language" | "locationType" | "preferredLabelValues" | "returnInputLocation">> {
  /**
   * The point at which to search for the closest address. The location
   * should be in the same spatial reference as that of the geocode service.
   *
   * @since 5.0
   * @see [ArcGIS REST APIs | reverseGeocode | location](https://developers.arcgis.com/rest/geocode/reverse-geocode/#location)
   */
  location?: PointProperties | null;
  /**
   * The spatial reference of the output geometries. If not specified, the output geometries are in the spatial reference of
   * the input geometries when performing a reverse geocode and in the default spatial reference returned by the service if
   * finding locations by address.
   *
   * @since 5.0
   * @see [ArcGIS REST APIs | reverseGeocode | outSR](https://developers.arcgis.com/rest/geocode/reverse-geocode/#outsr)
   */
  outSpatialReference?: SpatialReferenceProperties | null;
}

/**
 * Input parameters for [locationToAddress()](https://developers.arcgis.com/javascript/latest/references/core/rest/locator/#locationToAddress).
 *
 * @since 5.0
 * @module esri/rest/support/LocationToAddressParameters
 * @see module:esri/rest/locator
 */
export default class LocationToAddressParameters extends JSONSupport {
  constructor(properties?: LocationToAddressParametersProperties);
  /**
   * An authorization string used to access a resource or service.
   * [API keys](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/) are generated and managed in the portal.
   * An API key is tied explicitly to an ArcGIS account; it is also used to monitor service usage.
   * Setting a fine-grained API key on a specific class overrides the [global API key](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-apiKey).
   *
   * @since 5.1
   * @see [API keys](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/)
   * @see [Display a map tutorial - get an access token](https://developers.arcgis.com/javascript/latest/display-a-map/#get-an-access-token)
   * @see [ArcGIS REST APIs | reverseGeocode | token](https://developers.arcgis.com/rest/geocode/reverse-geocode/#token)
   */
  accessor apiKey: string | null | undefined;
  /**
   * The property limits the possible match types returned by the reverseGeocode operation.
   *
   * @since 5.1
   * @see [ArcGIS REST APIs | reverseGeocode | featureTypes](https://developers.arcgis.com/rest/geocode/reverse-geocode/#featuretypes)
   */
  accessor featureTypes: GeocodeFeatureType[] | null | undefined;
  /**
   * This property sets the language in which reverse-geocoded addresses are returned. Addresses in many countries are
   * available in more than one language; in these cases, this property can be used to specify which language should be
   * used for addresses returned by the reverseGeocode operation.
   *
   * @since 5.1
   * @see [ArcGIS REST APIs | reverseGeocode | langCode](https://developers.arcgis.com/rest/geocode/reverse-geocode/#langcode)
   * @see [ArcGIS REST APIs | reverseGeocode | Supported language codes](https://developers.arcgis.com/rest/geocode/geocode-coverage/#supported-language-codes)
   */
  accessor language: string | null | undefined;
  /**
   * The point at which to search for the closest address. The location
   * should be in the same spatial reference as that of the geocode service.
   *
   * @since 5.0
   * @see [ArcGIS REST APIs | reverseGeocode | location](https://developers.arcgis.com/rest/geocode/reverse-geocode/#location)
   */
  get location(): Point | null | undefined;
  set location(value: PointProperties | null | undefined);
  /**
   * Specifies whether the output geometry of `"point-address"` and `"sub-address"` matches should be the rooftop point
   * or street entrance location. Valid values are `"rooftop"` and `"street"`. The default value is `"rooftop". See [World Geocoding Service](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm).
   *
   * @since 5.0
   * @see [ArcGIS REST APIs | Category filtering](https://developers.arcgis.com/rest/geocode/category-filtering/)
   * @see [ArcGIS REST APIs | reverseGeocode | locationType](https://developers.arcgis.com/rest/geocode/reverse-geocode/#locationtype)
   */
  accessor locationType: LocationType | null | undefined;
  /**
   * The spatial reference of the output geometries. If not specified, the output geometries are in the spatial reference of
   * the input geometries when performing a reverse geocode and in the default spatial reference returned by the service if
   * finding locations by address.
   *
   * @since 5.0
   * @see [ArcGIS REST APIs | reverseGeocode | outSR](https://developers.arcgis.com/rest/geocode/reverse-geocode/#outsr)
   */
  get outSpatialReference(): SpatialReference | null;
  set outSpatialReference(value: SpatialReferenceProperties | null);
  /**
   * Defines how city names are resolved when ambiguity exists.
   *
   * Possible Value          | Description
   * ------------------------|------------------------
   * local-city              | Include the primary local city name in geocoding response output fields. This is the name of the city that the address is within, and may be different than the postal city.
   * postal-city             | Include the primary postal city value in geocoding response output fields. This is the primary name assigned to the postal code of the address.
   *
   * @since 5.1
   * @see [ArcGIS REST APIs | reverseGeocode | preferredLabelValues](https://developers.arcgis.com/rest/geocode/reverse-geocode/#preferredlabelvalues)
   */
  preferredLabelValues?: GeocodePreferredLabel | null;
  /**
   * Specifies what the type of the location returned.
   *
   * Possible Value          | Description
   * ------------------------|------------------------
   * false                   | The response will include the reverse geocoded location. This is the default.
   * true                    | The response will include the input location.
   *
   * @since 5.1
   * @see [ArcGIS REST APIs | reverseGeocode | returnInputLocation](https://developers.arcgis.com/rest/geocode/reverse-geocode/#returninputlocation)
   */
  accessor returnInputLocation: boolean | null | undefined;
}