import type Accessor from "../../core/Accessor.js";
import type Extent from "../../geometry/Extent.js";
import type SpatialReference from "../../geometry/SpatialReference.js";
import type { SpatialReferenceProperties } from "../../geometry/SpatialReference.js";
import type { ExtentProperties } from "../../geometry/Extent.js";

export interface GPOptionsProperties extends Partial<Pick<GPOptions, "returnColumnName" | "returnFeatureCollection" | "returnM" | "returnZ">> {
  /**
   * The spatial reference of the output geometries. If not specified, the output geometries will be
   * in the spatial reference of the input geometries. If [processSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/GPOptions/#processSpatialReference)
   * is specified and `outSpatialReference` is not specified, the output geometries will be in the
   * spatial reference of the process spatial reference.
   */
  outSpatialReference?: SpatialReferenceProperties | null;
  /** Limits processing to features within this extent. */
  processExtent?: ExtentProperties | null;
  /**
   * The spatial reference that the model will use to perform geometry operations.
   * If `processSpatialReference` is specified and [outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/GPOptions/#outSpatialReference)
   * is not specified, the output geometries will be in the spatial reference of the process
   * spatial reference.
   *
   * A possible common scenario for using `processSpatialReference` and `outSpatialReference` is
   * that you would like to perform spatial operations like buffer or clip on a projected coordinate
   * system such as web mercator. And you would like to recieve the output based on a geographic
   * coordinates such as WGS84.
   */
  processSpatialReference?: SpatialReferenceProperties | null;
}

/**
 * A convenience module for providing input options for the geoprocessing service return values.
 *
 * @since 4.19
 */
export default class GPOptions extends Accessor {
  constructor(properties?: GPOptionsProperties);
  /**
   * The spatial reference of the output geometries. If not specified, the output geometries will be
   * in the spatial reference of the input geometries. If [processSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/GPOptions/#processSpatialReference)
   * is specified and `outSpatialReference` is not specified, the output geometries will be in the
   * spatial reference of the process spatial reference.
   */
  get outSpatialReference(): SpatialReference | null | undefined;
  set outSpatialReference(value: SpatialReferenceProperties | null | undefined);
  /** Limits processing to features within this extent. */
  get processExtent(): Extent | null | undefined;
  set processExtent(value: ExtentProperties | null | undefined);
  /**
   * The spatial reference that the model will use to perform geometry operations.
   * If `processSpatialReference` is specified and [outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/GPOptions/#outSpatialReference)
   * is not specified, the output geometries will be in the spatial reference of the process
   * spatial reference.
   *
   * A possible common scenario for using `processSpatialReference` and `outSpatialReference` is
   * that you would like to perform spatial operations like buffer or clip on a projected coordinate
   * system such as web mercator. And you would like to recieve the output based on a geographic
   * coordinates such as WGS84.
   */
  get processSpatialReference(): SpatialReference | null | undefined;
  set processSpatialReference(value: SpatialReferenceProperties | null | undefined);
  /**
   * When `true`, individual values in a value table will be prefixed with the associated column name.
   * If false, the default, a value table will consist as a two dimensional array of values.
   * This property is referenced by [execute()](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/#execute) and [JobInfo.fetchResultData()](https://developers.arcgis.com/javascript/latest/references/core/rest/support/JobInfo/#fetchResultData).
   *
   * @default false
   * @since 4.29
   * @see [Geoprocessing service data types - GPValueTable](https://developers.arcgis.com/rest/services-reference/enterprise/gp-data-types/#gpvaluetable)
   */
  accessor returnColumnName: boolean;
  /**
   * When `true`, a parameter value of type `"feature-record-set-layer"` will be returned as a [feature layer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
   * rather than a [feature set](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/). This property is referenced by [execute()](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/#execute)
   * and [JobInfo.fetchResultData()](https://developers.arcgis.com/javascript/latest/references/core/rest/support/JobInfo/#fetchResultData). The default is false.
   *
   * @default false
   * @since 4.31
   * @see [Execute a task | Request parameters](https://developers.arcgis.com/rest/services-reference/enterprise/execute-gp-task/#request-parameters)
   * @see [Result parameters | Request parameters](https://developers.arcgis.com/rest/services-reference/enterprise/gp-result/#request-parameters)
   */
  accessor returnFeatureCollection: boolean;
  /**
   * Returns geometry with measures when [LastMileDeliveryParameters.routeShape](https://developers.arcgis.com/javascript/latest/references/core/rest/support/LastMileDeliveryParameters/#routeShape) is `shape-with-measures`. If `true`, m-values will be included in the results if the features have m-values; otherwise, m-values are not returned. The default is false.
   *
   * @default false
   */
  accessor returnM: boolean;
  /**
   * Returns geometry with heights (z) if and when the source network dataset contains height information.
   * If `true`, z-values will be included in the results if the features have z-values.
   * Otherwise, z-values are not returned. The default is false.
   *
   * @default false
   */
  accessor returnZ: boolean;
}