import type NetworkElement from "./NetworkElement.js";
import type { JSONSupport } from "../../../core/JSONSupport.js";
import type { DirtyStatusFilterType, ErrorStatusFilterType } from "../../../networks/support/typeUtils.js";

export interface TraverseAssociationsParametersProperties extends Partial<Pick<TraverseAssociationsParameters, "direction" | "dirtyStatusFilter" | "elements" | "errorStatusFilter" | "gdbVersion" | "maxDepth" | "stopAtFirstSpatial">> {
  /**
   * The date/timestamp (in UTC) to execute the function. 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;
}

/**
 * TraverseAssociationsParameters describes the optional parameters to execute the [traverseAssociations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/traverseAssociations/) function, which returns a list of [associations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/Association/) and [objects](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/TraverseAssociationsResult/) filtered by the parameters set.
 *
 * @since 5.2
 * @see [Association](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/Association/)
 * @see [TraverseAssociationsResult](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/TraverseAssociationsResult/)
 * @see [traverseAssociations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/traverseAssociations/)
 * @example
 * // Define the TraverseAssociationsParameters
 * const traverseAssociationsParameters = new TraverseAssociationsParameters({
 *   direction: "ascending",
 *   stopAtFirstSpatial: false,
 *   elements: [
 *     {
 *       networkSourceId: 10,
 *       globalId: "{456C46BC-C7A2-4963-8670-FE2B6B299758}",
 *     },
 *   ],
 * });
 *
 * // Traverse associations
 * const response = await traverseAssociations(networkServiceUrl, queryAssociationsParameters);
 *
 * // Print out the first association and first object
 * console.log(response.associations[0]);
 * console.log(response.objects[0]);
 */
export default class TraverseAssociationsParameters extends JSONSupport {
  constructor(properties?: TraverseAssociationsParametersProperties);
  /** Specifies the direction of the association traversal. */
  accessor direction: [
      "ascending" | "descending"
  ] | null | undefined;
  /** Specifies whether to filter based on the dirty status of the association. Possible values: none | dirty | notDirty */
  accessor dirtyStatusFilter: DirtyStatusFilterType | null | undefined;
  /** The [NetworkElements](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/NetworkElement/) for which the association traversal is initiated. */
  accessor elements: NetworkElement[] | null | undefined;
  /** Specifies whether to filter associations based on the error code. Possible values: none | inError | notInError */
  accessor errorStatusFilter: ErrorStatusFilterType | null | undefined;
  /** The geodatabase version to execute the function against. Defaults to `SDE.DEFAULT`, if no version is provided. */
  accessor gdbVersion: string | null | undefined;
  /** Specifies how many hops through the association graph are allowed in either the ascending or descending `direction`. Defaults to MAX_INT. */
  accessor maxDepth: number | null | undefined;
  /**
   * The date/timestamp (in UTC) to execute the function. 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);
  /**
   * If `true`, the traversal of associations from nonspatial object to feature will stop when a spatial feature is encountered.
   * The traversal will stop at the feature and will not traverse to the next nonspatial object.
   */
  accessor stopAtFirstSpatial: boolean | null | undefined;
}