import type { AbortOptions } from "../promiseUtils.js";

export type OpenStrategy = "distributed" | "dedicated" | "local";

export interface OpenOptions extends AbortOptions {
  /** The objects defining the API accessible from the module. */
  client?: any;
  /**
   * Indicates how to load the module. See the
   * table below for a list of possible values.
   *
   * Possible Value | Description
   * ---------------|------------
   * distributed | The module is loaded in each available worker. Each call to [Connection#invoke()](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#invoke) will be targeting an available worker. Use this strategy if the module doesn't maintain information between invocations (stateless).
   * dedicated | The module is loaded in one worker. Each call to [Connection#invoke()](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#invoke) will be targeting a same worker. Use this strategy if the module maintains information from previous invocations or communication between main and worker threads needs to be stateful.
   * local | The module is loaded in the main thread. Use this strategy when using the worker framework API while disabling the use of workers.
   *
   * @default distributed
   */
  strategy?: OpenStrategy;
}