import type { JSONSupport } from "../../core/JSONSupport.js";
import type { ParameterValue as ParameterValueType } from "../types.js";

export interface ParameterValueProperties<T extends ParameterValueType = ParameterValueType> extends Partial<Pick<ParameterValue<T>, "dataType" | "paramName" | "value">> {}

/**
 * Represents the output parameters of a [geoprocessor](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/) method
 * and their properties and values.
 *
 * @since 4.0
 * @see [geoprocessor](https://developers.arcgis.com/javascript/latest/references/core/rest/geoprocessor/)
 * @see [GPMessage](https://developers.arcgis.com/javascript/latest/references/core/rest/support/GPMessage/)
 * @see [JobInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/support/JobInfo/)
 */
export default class ParameterValue<T extends ParameterValueType = ParameterValueType> extends JSONSupport {
  constructor(properties?: ParameterValueProperties<T>);
  /** Specifies the parameter's data type. */
  dataType: T["dataType"];
  /**
   * The name of the parameter the value is for.
   *
   * @since 4.28
   */
  accessor paramName: string | null | undefined;
  /**
   * The value of the parameter. The structure of this value depends on the [data type](https://developers.arcgis.com/javascript/latest/references/core/rest/support/ParameterValue/#dataType) of the parameter.
   * The value could be a single value or an array of values. The table below lists the singular _data types_.
   *
   * | Data Type                | JavaScript Type |
   * |--------------------------|-----------------|
   * | areal-unit               | [ArealUnit](https://developers.arcgis.com/javascript/latest/references/core/rest/support/ArealUnit/) |
   * | boolean                  | [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) |
   * | data-file                | [DataFile](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/) |
   * | date                     | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) |
   * | double                   | [Number (float)](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) |
   * | feature-record-set-layer | [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/), [DataFile](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/), or [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) |
   * | field                    | [Field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) |
   * | linear-unit              | [LinearUnit](https://developers.arcgis.com/javascript/latest/references/core/rest/support/LinearUnit/) |
   * | long                     | [Number (int)](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) |
   * | raster-data              | [RasterData](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RasterData/) or [MapImage](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MapImage/) |
   * | raster-data-layer        | [RasterData](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RasterData/) or [MapImage](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MapImage/) |
   * | record-set               | [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) or [DataFile](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/) |
   * | string                   | [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) |
   * | time-unit                | [TimeUnit](https://developers.arcgis.com/javascript/latest/references/core/rest/support/TimeUnit/) |
   * | value-table              | [Value table](https://developers.arcgis.com/rest/services-reference/enterprise/gp-data-types/#gpvaluetable) is a flexible table-like object consisting of rows and columns containing various values. |
   *
   * Alternatively, this property could be an array of values. The table below lists all valid arrays.
   *
   * | Data Type                            | JavaScript Type |
   * |--------------------------------------|-----------------|
   * | multi-value-areal-unit               | An array of [areal units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/ArealUnit/) |
   * | multi-value-boolean                  | An array of [booleans](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) |
   * | multi-value-composite                | An array containing any combination of singular data types in the table above excluding `value-table`. See [GPComposite](https://developers.arcgis.com/rest/services-reference/enterprise/gp-data-types/#gpcomposite). |
   * | multi-value-data-file                | An array of [data files](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/) |
   * | multi-value-date                     | An array of [dates](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) |
   * | multi-value-double                   | An array of [doubles](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) |
   * | multi-value-feature-record-set-layer | An array of [feature sets](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/), [data files](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/), or [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) |
   * | multi-value-field                    | An array of [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) |
   * | multi-value-linear-unit              | An array of [linear units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/LinearUnit/) |
   * | multi-value-long                     | An array of [longs](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) |
   * | multi-value-raster-data              | An array of [rasters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RasterData/) or [map images](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MapImage/) |
   * | multi-value-raster-data-layer        | An array of [rasters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RasterData/) or [map images](https://developers.arcgis.com/javascript/latest/references/core/layers/support/MapImage/) |
   * | multi-value-record-set               | An array of [feature sets](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) or [data files](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DataFile/) |
   * | multi-value-time-unit                | An array of [Time units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/TimeUnit/) |
   * | multi-value-string                   | An array of [strings](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) |
   *
   * @see [Geoprocessing service data types](https://developers.arcgis.com/rest/services-reference/enterprise/gp-data-types.htm)
   */
  accessor value: T["value"];
}