import type UtilityNetwork from "./UtilityNetwork.js";
import type UnitQueryResult from "../rest/networks/unitIdentifiers/support/UnitQueryResult.js";
import type { JSONSupport, JSONSupportMixinProperties } from "../core/JSONSupport.js";
import type { UnitIdentifier } from "./support/jsonTypes.js";
import type { UtilityNetworkProperties } from "./UtilityNetwork.js";

export interface UnitIdentifierManagerProperties extends JSONSupportMixinProperties {
  /**
   * The [UtilityNetwork](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html) that contains the telecom
   * domain network being managed.
   */
  utilityNetwork?: UtilityNetworkProperties;
}

/**
 * A UnitIdentifierManager provides access to unit identifier management capabilities for a
 * telecom domain network in a utility network.
 *
 * @beta
 * @since 4.34
 * @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html)
 * @see [CircuitManager](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-CircuitManager.html)
 * @see [Telecom domain network](https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/telecom-domain-networks.htm)
 * @example
 * const utilityNetwork = new UtilityNetwork({
 *   layerUrl: "https://host.com/arcgis/rest/services/Test/FeatureServer/0",
 * });
 *
 * await utilityNetwork.load();
 *
 * const unitIdentifierManager = await utilityNetwork.getUnitIdentifierManager();
 */
export default class UnitIdentifierManager extends JSONSupport {
  constructor(properties?: UnitIdentifierManagerProperties);
  /**
   * Returns the root feature service URL which the utility network is part of.
   *
   * @example `https://utilitynetwork.esri.com/server/rest/services/NapervilleElectric/FeatureServer/`
   */
  get featureServiceUrl(): string;
  /**
   * The version of the geodatabase of the feature service data used by the utility network.
   * Read the [Overview of versioning](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/overview-of-versioning-in-arcgis-pro.htm)
   * topic for more details about this capability.
   */
  get gdbVersion(): string | null | undefined;
  /**
   * The utility network's historic moment to query.
   * If this property is not specified, queries will apply to the current features.
   */
  get historicMoment(): Date | null | undefined;
  /**
   * The URL of the network server.
   *
   * @example `https://utilitynetwork.esri.com/server/rest/services/NapervilleElectric/UtilityNetworkServer/`
   */
  get networkServiceUrl(): string;
  /**
   * The [UtilityNetwork](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html) that contains the telecom
   * domain network being managed.
   */
  get utilityNetwork(): UtilityNetwork;
  /**
   * Shifts existing records in the containment hierarchy of a unit container's NextUnitID sequence
   * to reserve a range of unit IDs in a telecom domain network.
   *
   * When a gap is inserted at the end of the sequence, the `NEXTUNITID` attribute value for the unit container increases.
   * If a gap is inserted into the middle of an existing sequence, the system will attempt to shift existing
   * records to accommodate the reserved space. The operation will fail and return an error if the reservation requires
   * regrouping an object or occurs in the middle of a connectivity assignment.
   *
   * @param container - The unit container to insert a gap into.
   * @param firstUnit - The first unit for the gap to be introduced.
   * @param numUnits - The number of units in the gap.
   * @returns Resolves when the gap is successfully inserted.
   */
  insertGap(container: UnitIdentifier, firstUnit: number, numUnits: number): Promise<void>;
  /**
   * Returns unit identifiers for, and existing gaps in, a unit container feature's containment hierarchy in a
   * telecom domain network.
   *
   * @param containers - The unit container features or objects to query.
   * @returns Resolves to an array of objects describing
   *   the unit identifiers and gaps for the specified unit containers.
   */
  query(containers: UnitIdentifier[]): Promise<UnitQueryResult[]>;
  /**
   * Resets the unit identifiers associated with one or more unit container features in a telecom domain network.
   * This is done to condense the unit identifier space or overcome unit identifier sequence exhaustion.
   *
   * @param containers - The unit container features or objects to be reset.
   * @returns Resolves when the containers are successfully reset.
   */
  reset(containers: UnitIdentifier[]): Promise<void>;
  /**
   * Alters the number of units associated with a unit identifier feature in a telecom domain network.
   *
   * @param content - The unit identifiable feature or object being resized.
   * @param numUnits - The number of units for the feature or object to be resized to.
   * @returns Resolves when the feature or object is successfully resized.
   */
  resize(content: UnitIdentifier, numUnits: number): Promise<void>;
}