import type NetworkElement from "./NetworkElement.js";
import type { JSONSupport } from "../../../core/JSONSupport.js";
import type { AssociationType } from "../../../networks/support/typeUtils.js";
import type { NetworkElementProperties } from "./NetworkElement.js";

export interface QueryAssociationsParametersProperties extends Partial<Pick<QueryAssociationsParameters, "gdbVersion" | "returnDeletes" | "types">> {
  /** The [NetworkElements](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/NetworkElement/) for which the association is queried. */
  elements?: NetworkElementProperties[];
  /**
   * 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;
}

/**
 * QueryAssociationsParameters describes the parameters required to execute the [queryAssociations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/queryAssociations/) function, which returns a list of [associations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/Association/) filtered by the parameters set.
 *
 * @since 4.24
 * @see [Association](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/Association/)
 * @see [QueryAssociationsResult](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/QueryAssociationsResult/)
 * @see [queryAssociations](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/queryAssociations/)
 * @example
 * // Define the QueryAssociationsParameters
 * const queryAssociationsParameters = new QueryAssociationsParameters({
 *   types: ["containment", "attachment", "junction-edge-from-connectivity"],
 *   elements: [
 *     {
 *       networkSourceId: 2,
 *       globalId: "{46B3FA19-2237-4D38-A7CF-AA34C3T40420}",
 *       objectId: 44,
 *       terminalId: 1,
 *       assetGroupCode: 1,
 *       assetTypeCode: 1
 *     },
 *     {
 *       networkSourceId: 9,
 *       globalId: "{321C0089-1165-42D9-K45B-ED91B1A40500}",
 *       objectId: 45,
 *       terminalId: 1,
 *       assetGroupCode: 13,
 *       assetTypeCode: 441
 *     }
 *  ]
 * });
 *
 * // Query associations, and assign the query result to a variable `associations`
 * const associations = await queryAssociations(networkServiceUrl, queryAssociationsParameters);
 *
 * // Print out the first association
 * console.log(associations[0]);
 */
export default class QueryAssociationsParameters extends JSONSupport {
  constructor(properties?: QueryAssociationsParametersProperties);
  /** The [NetworkElements](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/NetworkElement/) for which the association is queried. */
  get elements(): NetworkElement[];
  set elements(value: NetworkElementProperties[]);
  /** The geodatabase version to execute the function against. Defaults to `SDE.DEFAULT`, if no version is provided. */
  accessor gdbVersion: string | 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 response includes associations that have been deleted.
   *
   * @default false
   */
  accessor returnDeletes: boolean;
  /**
   * The association types to query.
   * Junction-edge connectivity associations are used to establish a relationship between a point feature or junction object and an edge object.
   * - `Junction-edge from connectivity`
   * - `Junction-edge midspan connectivity`
   * - `Junction-edge to connectivity`
   *
   * These association types enable connectivity to be established between nonspatial junction and edge objects and provide an additional method to model connectivity between noncoincident point features using an edge object.
   *
   * **Possible Values**
   *
   * Value | Description |
   * ----- | ----------- |
   * connectivity | Allows modeling the connectivity between two features that are not coincident or between spatial features and nonspatial junction and edge objects.
   * junction-junction-connectivity | Allows modeling the connectivity between two features that are not coincident or between spatial features and nonspatial junction and edge objects.
   * attachment | Allows the modeling of supporting structures and attachments in a network.
   * containment | Allows a dense collection of features to be represented by a single feature.
   * junction-edge-from-connectivity | Junction edge from connectivity.
   * junction-edge-midspan-connectivity | Junction edge midspan connectivity.
   * junction-edge-to-connectivity | Junction edge to connectivity.
   *
   * > [!WARNING]
   * >
   * > The "connectivity" type has been deprecated since version 4.29. Please use "junction-junction-connectivity" instead.
   *
   * @see [ArcGIS Pro: Connectivity associations](https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/connectivity.htm)
   */
  accessor types: AssociationType[];
}