import type ExportCircuitsResult from "../../rest/networks/circuits/support/ExportCircuitsResult.js";
import type { WaitOptions } from "./typeUtils.js";
import type { RequestOptions } from "../../request/types.js";

export interface CircuitExportJobInfoProperties extends Partial<Pick<CircuitExportJobInfo, "status" | "statusUrl">> {
  /** The last date and time the service was updated. */
  lastUpdatedTime?: (Date | number | string) | null;
  /** The date and time in which [CircuitManager.submitExportJob()](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/#submitExportJob) is first called. */
  submissionTime?: (Date | number | string) | null;
}

export type CircuitExportJobStatus = "job-waiting" | "job-executing" | "job-succeeded";

export interface WaitForExportOptions extends WaitOptions<CircuitExportJobInfo> {}

/**
 * Represents information pertaining to the execution of an asynchronous [CircuitManager.submitExportJob()](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/#submitExportJob) request on the server.
 *
 * @since 5.1
 * @see [ExportCircuitsParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/circuits/support/ExportCircuitsParameters/)
 * @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
 */
export default class CircuitExportJobInfo extends ExportCircuitsResult {
  constructor(properties?: CircuitExportJobInfoProperties);
  /** The last date and time the service was updated. */
  get lastUpdatedTime(): Date | null | undefined;
  set lastUpdatedTime(value: (Date | number | string) | null | undefined);
  /**
   * The job status.
   *
   * @default "job-waiting"
   */
  status: CircuitExportJobStatus;
  /** ArcGIS Server Rest API endpoint to the resource that receives the export circuits request. */
  accessor statusUrl: string;
  /** The date and time in which [CircuitManager.submitExportJob()](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/#submitExportJob) is first called. */
  get submissionTime(): Date | null | undefined;
  set submissionTime(value: (Date | number | string) | null | undefined);
  /**
   * Sends a request for the current state of this job.
   *
   * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/#request) to be used for the data request
   * (will override requestOptions defined during construction).
   * @returns When resolved, returns a [CircuitExportJobInfo](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitExportJobInfo/).
   */
  checkJobStatus(requestOptions?: RequestOptions | null): Promise<CircuitExportJobInfo>;
  /**
   * Stop monitoring this job for status updates.
   *
   * ```
   * // Stop monitoring this job for status updates.
   * jobInfo.destroy();
   * ```
   *
   * @see [waitForJobCompletion()](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitExportJobInfo/#waitForJobCompletion)
   */
  destroy(): void;
  /**
   * Resolves when an asynchronous job has completed. Optionally job progress can be monitored.
   *
   * @param options - Options. See properties below for object specifications.
   * @returns When resolved, returns a [CircuitExportJobInfo](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitExportJobInfo/).
   */
  waitForJobCompletion(options?: WaitForExportOptions): Promise<CircuitExportJobInfo>;
}