import type Basemap from "../../Basemap.js";
import type Collection from "../../core/Collection.js";
import type Portal from "../../portal/Portal.js";
import type BasemapGalleryItem from "./support/BasemapGalleryItem.js";
import type LocalBasemapsSource from "./support/LocalBasemapsSource.js";
import type PortalBasemapsSource from "./support/PortalBasemapsSource.js";
import type { BasemapProperties } from "../../Basemap.js";
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
import type { Loadable, LoadableMixinProperties } from "../../core/Loadable.js";
import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
import type { LocalBasemapsSourceProperties } from "./support/LocalBasemapsSource.js";
import type { PortalBasemapsSourceProperties } from "./support/PortalBasemapsSource.js";

export interface BasemapGalleryViewModelProperties extends LoadableMixinProperties, Partial<Pick<BasemapGalleryViewModel, "view">> {
  /** The map's [Map.basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap). */
  activeBasemap?: BasemapProperties | string | null;
  /**
   * The source for basemaps that the Basemap Gallery will display.
   * This property can be autocast with an array or [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html)s, or
   * a [Portal](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html) instance.
   * The default source is a [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html) that points to
   * the default portal instance set in [esriConfig.portalUrl](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#ConfigWithPortalUrl).
   */
  source?: Portal | LocalBasemapsSourceProperties | ReadonlyArrayOrCollection<Basemap> | PortalBasemapsSourceProperties;
}

export type BasemapGalleryViewModelState = "disabled" | "loading" | "ready" | "unsupported";

/**
 * Provides the logic for the [BasemapGallery widget](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html) and [component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-basemap-gallery/).
 *
 * @since 4.3
 * @see [BasemapGallery widget](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html) - _Deprecated since 4.32. Use the [Basemap Gallery component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-basemap-gallery/) instead._
 * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 */
export default class BasemapGalleryViewModel extends Loadable {
  constructor(properties?: BasemapGalleryViewModelProperties);
  /** The map's [Map.basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap). */
  get activeBasemap(): Basemap | null;
  set activeBasemap(value: BasemapProperties | string | null | undefined);
  /**
   * The current index of the active [Map.basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap)
   * in the [BasemapGallery](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html).
   *
   * @since 4.32
   */
  get activeBasemapIndex(): number;
  /** A collection of [BasemapGalleryItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-BasemapGalleryItem.html)s representing basemaps. */
  get items(): Collection<BasemapGalleryItem>;
  /**
   * The source for basemaps that the Basemap Gallery will display.
   * This property can be autocast with an array or [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html)s, or
   * a [Portal](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html) instance.
   * The default source is a [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html) that points to
   * the default portal instance set in [esriConfig.portalUrl](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#ConfigWithPortalUrl).
   */
  get source(): LocalBasemapsSource | PortalBasemapsSource;
  set source(value: Portal | LocalBasemapsSourceProperties | ReadonlyArrayOrCollection<Basemap> | PortalBasemapsSourceProperties);
  /**
   * The view model's state.
   *
   * @default "disabled"
   */
  get state(): BasemapGalleryViewModelState;
  /**
   * The view from which the Basemap Gallery will operate. This view
   * provides access to the active
   * [Map.basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap)
   * via the view's [View.map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#map) property.
   */
  accessor view: MapViewOrSceneView | null | undefined;
  /**
   * A convenience function to check basemap equality.
   *
   * @param basemap1 - The basemap to compare against `basemap2`.
   * @param basemap2 - The basemap to compare against `basemap1`.
   * @returns Returns `true` if both basemaps are equal, `false` otherwise.
   */
  basemapEquals(basemap1: Basemap | null | undefined, basemap2: Basemap | null | undefined): boolean;
}