/**
 * Point on the screen (x, y) in the DOM/CSS coordinate space. In this space, the origin is at the top/left corner and
 * device pixel ratio scale is not taken into account (i.e. 1px in this space may make up multiple physical pixels).
 *
 * @since 4.11
 * @example const sourcePoint = { x: 80, y: 1732 }
 */
export interface ScreenPoint {
  /**
   * The x coordinate in pixels.
   *
   * @since 5.0
   */
  x: number;
  /**
   * The y coordinate in pixels.
   *
   * @since 5.0
   */
  y: number;
}

/** @since 5.1 */
export interface ScreenRect {
  /**
   * The x coordinate in pixels.
   *
   * @since 5.1
   */
  x: number;
  /**
   * The y coordinate in pixels.
   *
   * @since 5.1
   */
  y: number;
  /**
   * The width in pixels.
   *
   * @since 5.1
   */
  width: number;
  /**
   * The height in pixels.
   *
   * @since 5.1
   */
  height: number;
}

/**
 * A custom log interceptor function.
 *
 * > [!WARNING]
 * > In 5.x, the `module` parameter uses `esri.`-style module identifiers (for example `esri.layers.FeatureLayer`) even when using the ESM build.
 * >
 * > In 6.0, this will change to `@arcgis/core/`-style module identifiers (for example `@arcgis/core/layers/FeatureLayer`).
 *
 * @param level - The level of the message.
 * @param module - The module from which the log message originated.
 * @param args - Arguments of any type to be logged.
 * @returns Return true to indicate the log message has been handled and should no longer be processed
 * (neither by other interceptors nor by the default handler which logs messages to the console).
 * @since 5.0
 * @example
 * // Only show error messages, not warnings nor info messages
 * esriConfig.log.level = "error";
 *
 * esriConfig.log.interceptors.push(function(level, module, ...args) {
 *   // Send all messages to a REST end-point
 *   request(loggingUrl, {
 *     method: "post",
 *     body: {
 *             level: level,
 *             module: module,
 *             details: JSON.stringify(args)
 *           }
 *   });
 *
 *   // Return false so that the default log handler still writes log messages to the console
 *   return false;
 * });
 */
export type LogInterceptor = (level: "error" | "warn" | "info", module: string, ...args: any[]) => boolean;