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/references/core/Map/#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/references/core/core/Collection/) of [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/)s, or
   * a [Portal](https://developers.arcgis.com/javascript/latest/references/core/portal/Portal/) instance.
   * The default source is a [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/support/PortalBasemapsSource/) that points to
   * the default portal instance set in [esriConfig.portalUrl](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-portalUrl).
   */
  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/references/core/widgets/BasemapGallery/) and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-gallery/).
 *
 * @since 4.3
 * @see [BasemapGallery widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/) - _Deprecated since 4.32. Use the [Basemap Gallery component](https://developers.arcgis.com/javascript/latest/references/map-components/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/references/core/Map/#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/references/core/Map/#basemap)
   * in the [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/).
   *
   * @since 4.32
   */
  get activeBasemapIndex(): number;
  /** A collection of [BasemapGalleryItem](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/support/BasemapGalleryItem/)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/references/core/core/Collection/) of [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/)s, or
   * a [Portal](https://developers.arcgis.com/javascript/latest/references/core/portal/Portal/) instance.
   * The default source is a [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/support/PortalBasemapsSource/) that points to
   * the default portal instance set in [esriConfig.portalUrl](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-portalUrl).
   */
  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/references/core/Map/#basemap)
   * via the view's [View.map](https://developers.arcgis.com/javascript/latest/references/core/views/View/#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;
}