import type Accessor from "../../core/Accessor.js";
import type { ScaleRange } from "../../layers/types.js";

export interface ScaleRangesProperties {}

/** Lists the recommended scales for each named scale range. */
export interface RecommendedScales {
  world: 147914382;
  /** @default 50000000 */
  continent: 50000000;
  /** @default 25000000 */
  countriesBig: 25000000;
  /** @default 12000000 */
  countriesSmall: 12000000;
  /** @default 6000000 */
  statesProvinces: 6000000;
  /** @default 3000000 */
  stateProvince: 3000000;
  /** @default 1500000 */
  counties: 1500000;
  /** @default 750000 */
  county: 750000;
  /** @default 320000 */
  metropolitanArea: 320000;
  /** @default 160000 */
  cities: 160000;
  /** @default 80000 */
  city: 80000;
  /** @default 40000 */
  town: 40000;
  /** @default 20000 */
  neighborhood: 20000;
  /** @default 10000 */
  streets: 10000;
  /** @default 5000 */
  street: 5000;
  /** @default 2500 */
  buildings: 2500;
  /** @default 1250 */
  building: 1250;
  /** @default 800 */
  smallBuilding: 800;
  /** @default 400 */
  rooms: 400;
  /** @default 100 */
  room: 100;
}

/** The NamedScaleRange provides the minimum and maximum scale of an named scale id. */
export interface NamedScaleRange extends ScaleRange {
  /** The named scale range, such as "room" or "metropolitan area". */
  id: keyof RecommendedScales;
}

/**
 * The ScaleRanges class represents the ranges of scales for the
 * [ScaleRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/) widget.
 *
 * @since 4.13
 * @see [ScaleRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/)
 * @see [ScaleRangeSliderViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel/)
 */
export default class ScaleRanges extends Accessor {
  /** The recommended scales at each of the named scale ranges. */
  static readonly RecommendedScales: RecommendedScales;
  /**
   * Helper to create a ScaleRanges object from a minimum and maximum scale.
   *
   * @param scaleRange - The scale range.
   * @returns The scale ranges.
   */
  static fromScaleRange(scaleRange: ScaleRange): ScaleRanges;
  constructor(properties?: ScaleRangesProperties);
  /**
   * Clamps the scale to the closest minScale or maxScale on the scale range.
   * If the provided scale goes beyond the allowed range, it snaps back to the clamped value.
   *
   * @param scale - The scale value from the slider.
   * @returns The scale number to which the slider will clamp.
   */
  clampScale(scale: number): number;
  /**
   * Determines whether the given scale is within the current scale range.
   *
   * @param scale - The scale value.
   * @returns If `true`, the scale is contained within the range.
   */
  contains(scale: number): boolean;
  /**
   * Finds the scale range name at a given index.
   *
   * @param index - The index of the scale.
   * @returns The named scale range for the given index.
   */
  findScaleRangeByIndex(index: number): NamedScaleRange;
  /**
   * Determines if the input scale value can be considered to be at the smallest scale range edge.
   *
   * @param scale - The scale value to test against the scale range.
   * @returns If `true`, the input scale value is considered to be at the smallest scale range.
   */
  isMaxScaleEdge(scale: number): boolean;
  /**
   * Determines if the input scale value can be considered to be at the largest scale range edge.
   *
   * @param scale - The scale value to test against the scale range.
   * @returns If `true`, the input scale value is considered to be at the largest scale range.
   */
  isMinScaleEdge(scale: number): boolean;
}