import type SpatialReference from "../../../geometry/SpatialReference.js";
import type UNTraceConfiguration from "../../../networks/support/UNTraceConfiguration.js";
import type TraceLocation from "./TraceLocation.js";
import type { JSONSupport } from "../../../core/JSONSupport.js";
import type { ResultType } from "../../../networks/support/jsonTypes.js";
import type { TraceType } from "../../../networks/support/typeUtils.js";
import type { TraceLocationProperties } from "./TraceLocation.js";
import type { SpatialReferenceProperties } from "../../../geometry/SpatialReference.js";
import type { UNTraceConfigurationProperties } from "../../../networks/support/UNTraceConfiguration.js";

export interface TraceParametersProperties extends Partial<Pick<TraceParameters, "gdbVersion" | "namedTraceConfigurationGlobalId" | "resultTypes" | "traceType">> {
  /**
   * The date/timestamp (in UTC) to execute the function at a given time. This could be used to run the function in a moment in the past or in long transaction mode (undo/redo). Applicable to branch versioned datasets only.
   *
   * @see [Learn more about branch versioning](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/data-management-strategies.htm#ESRI_SECTION1_6FA2CFB5F9484FF096740D653C674B5D)
   */
  moment?: (Date | number | string) | null;
  /** The spatial reference that should be used to project the [aggregated geometries](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/AggregatedGeometry/) returned by the trace (if applicable). */
  outSpatialReference?: SpatialReferenceProperties | null;
  /** Defines the properties of a trace. */
  traceConfiguration?: UNTraceConfigurationProperties | null;
  /**
   * The list of starting points and barriers that will define where the trace starts and stops.
   * This parameter can be optional (defaults to empty array) if [NamedTraceConfiguration.minStartingPoints](https://developers.arcgis.com/javascript/latest/references/core/networks/support/NamedTraceConfiguration/#minStartingPoints) in `NamedTraceConfiguration` is set to `none`.
   */
  traceLocations?: TraceLocationProperties[];
}

/**
 * The list of parameters that are needed to determine how the trace analytic will be executed. This includes trace locations, type, trace configurations, result types, output, and many other parameters.
 *
 * @since 4.20
 * @see [trace](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/trace/)
 */
export default class TraceParameters extends JSONSupport {
  constructor(properties?: TraceParametersProperties);
  /** The geodatabase version to execute the function against. Defaults to `SDE.DEFAULT` when no version is provided. */
  accessor gdbVersion: string | null | undefined;
  /**
   * The date/timestamp (in UTC) to execute the function at a given time. This could be used to run the function in a moment in the past or in long transaction mode (undo/redo). Applicable to branch versioned datasets only.
   *
   * @see [Learn more about branch versioning](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/data-management-strategies.htm#ESRI_SECTION1_6FA2CFB5F9484FF096740D653C674B5D)
   */
  get moment(): Date | null | undefined;
  set moment(value: (Date | number | string) | null | undefined);
  /** The globalId (UUID) of the named trace configuration persisted in the network. */
  accessor namedTraceConfigurationGlobalId: string | null | undefined;
  /** The spatial reference that should be used to project the [aggregated geometries](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/AggregatedGeometry/) returned by the trace (if applicable). */
  get outSpatialReference(): SpatialReference | null | undefined;
  set outSpatialReference(value: SpatialReferenceProperties | null | undefined);
  /** Parameter specifying the types of results to return after running a trace. */
  accessor resultTypes: ResultType[] | null | undefined;
  /** Defines the properties of a trace. */
  get traceConfiguration(): UNTraceConfiguration | null | undefined;
  set traceConfiguration(value: UNTraceConfigurationProperties | null | undefined);
  /**
   * The list of starting points and barriers that will define where the trace starts and stops.
   * This parameter can be optional (defaults to empty array) if [NamedTraceConfiguration.minStartingPoints](https://developers.arcgis.com/javascript/latest/references/core/networks/support/NamedTraceConfiguration/#minStartingPoints) in `NamedTraceConfiguration` is set to `none`.
   */
  get traceLocations(): TraceLocation[];
  set traceLocations(value: TraceLocationProperties[]);
  /**
   * The [traceType](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/TraceParameters/#traceType) defined in this trace configuration.
   *
   * > [!WARNING]
   * >
   * > The `path` and `circuit` types are reserved for future use.
   */
  accessor traceType: TraceType | null | undefined;
}