import type Polygon from "../../geometry/Polygon.js";
import type Polyline from "../../geometry/Polyline.js";
import type SpatialReference from "../../geometry/SpatialReference.js";

export interface CutResult<T extends Polygon | Polyline> {
  cutIndexes: number[];
  geometries: T[];
}

export type ConversionType = "mgrs" | "usng" | "utm" | "geo-ref" | "gars" | "dms" | "ddm" | "dd";

export interface FromGeoCoordinateStringParameters {
  /**
   * Conversion options for mgrs and utm conversion types. See
   * the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/to-geocoordinatestring.htm)
   * for valid conversion modes and their descriptions.
   */
  conversionMode?: string;
  /**
   * The conversion type of the input strings.
   *
   * @default mrgs
   */
  conversionType?: ConversionType;
  /**
   * The spatial reference (or WKID of the spatial reference)
   * of the XY-coordinates to be converted.
   */
  sr?: SpatialReference | string | number;
  /**
   * An array of formatted strings as specified by `conversionType`.
   * Example: `["01N AA 66021 00000" , "11S NT 00000 62155" , "31U BT 94071 65288"]`
   */
  strings: string[];
}

export interface ToGeoCoordinateStringParameters extends Omit<FromGeoCoordinateStringParameters, "strings"> {
  /**
   * If `true`, then spaces are added between components of the string. The
   * `addSpaces` parameter applies only to conversion types `mgrs`, `usng` and `utm`. The default value for `mgrs` is `false`
   * , while the default value for both `usng` and `utm` is `true`.
   */
  addSpaces?: boolean;
  /** An array of XY-coordinates (in JSON format) to be converted. */
  coordinates: number[][];
  /**
   * The number of digits to output for each of the numerical portions in the string.
   * The default value depends of `conversionType`. See the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/from-geocoordinatestring.htm) for default values.
   */
  numOfDigits?: number;
  /**
   * If `true`, then numeric portions of the string are rounded to the nearest whole magnitude
   * as specified by `numOfDigits`. Otherwise, numeric portions of the string are truncated. The rounding parameter applies
   * only to conversion types `mgrs`, `usng` and `geo-ref`.
   *
   * @default true
   */
  rounding?: boolean;
}