import type { JSONSupport } from "../../../core/JSONSupport.js";

export interface ValidateNetworkTopologyResultProperties extends Partial<Pick<ValidateNetworkTopologyResult, "discoveredSubnetworks" | "exceededTransferLimit" | "fullUpdate" | "serviceEdits" | "validateErrorsCreated">> {
  /** The date/timestamp (in UTC) when the validate process was executed. */
  moment?: (Date | number | string) | null;
}

/**
 * ValidateServiceEdits represents the layerId and editedFeatures.
 *
 * @since 4.26
 */
export interface ValidateServiceEdits {
  /** The layerId of the layer with ServiceEdits. */
  layerId: number;
  /** The editedFeatures object returns full features including the original features prior to delete, the original and current features for updates, and the current rows for inserts, which may contain implicit changes (for example, as a result of a calculation rule). */
  editedFeatures?: object;
}

/**
 * The Subnetwork object represents the domain name, tier name, and subnetwork via fulfilling the promise returned from running the [Network.validateTopology()](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-Network.html#validateTopology) function.
 *
 * @since 4.26
 */
export interface Subnetwork {
  /** The domain name. */
  domain: string;
  /** The tier name. */
  tier: string;
  /** The subnetwork name. */
  subnetwork: string;
}

/**
 * Class that holds the returned object after running the [Network.validateTopology()](https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-Network.html#validateTopology) method.
 *
 * @since 4.26
 * @example
 * const extent = new Extent({
 *   xmin: 470789.0888,
 *   ymin: 3597733.2051,
 *   xmax: 531454.2759999996,
 *   ymax: 3639864.802100001,
 *   spatialReference: { wkid: 26911, latestWkid: 26911 }
 * });
 *
 * const validateNetworkTopologyResult = await network.validateTopology({
 *   validateArea: extent
 * });
 */
export default class ValidateNetworkTopologyResult extends JSONSupport {
  constructor(properties?: ValidateNetworkTopologyResultProperties);
  /** Contains information about the subnetworks that are marked as dirty during the validation process, along with the domain network and tier containing the subnetwork. */
  accessor discoveredSubnetworks: Subnetwork[] | null | undefined;
  /** If `maxRecordCount` is configured for a layer, `exceededTransferLimit` will be `true` if a query matches more than the `maxRecordCount` features. It will be `false` otherwise. */
  accessor exceededTransferLimit: boolean | null | undefined;
  /**
   * If the current feature service contains no dirty areas, full update will return true.
   *
   * @default false
   */
  accessor fullUpdate: boolean;
  /** The date/timestamp (in UTC) when the validate process was executed. */
  get moment(): Date | null | undefined;
  set moment(value: (Date | number | string) | null | undefined);
  /** The serviceEdits returns full features including the original features prior to delete, the original and current features for updates, and the current rows for inserts, which may contain implicit changes. */
  accessor serviceEdits: ValidateServiceEdits[] | null | undefined;
  /**
   * If error features are created during the validation process validateErrorsCreated will be true.
   *
   * @default false
   */
  accessor validateErrorsCreated: boolean;
}