import type Basemap from "../../../Basemap.js";
import type Collection from "../../../core/Collection.js";
import type Portal from "../../../portal/Portal.js";
import type LocalBasemapsSource from "./LocalBasemapsSource.js";
import type { LoadableMixin, LoadableMixinProperties } from "../../../core/Loadable.js";
import type { EsriPromiseMixin } from "../../../core/Promise.js";
import type { BasemapFilter, BasemapsSourceState, UpdateBasemapsCallback } from "../types.js";
import type { LocalBasemapsSourceProperties } from "./LocalBasemapsSource.js";
import type { PortalProperties } from "../../../portal/Portal.js";

export interface PortalBasemapsSourceProperties extends LocalBasemapsSourceProperties, LoadableMixinProperties, Partial<Pick<PortalBasemapsSource, "filterFunction" | "query" | "updateBasemapsCallback">> {
  /** The Portal from which to fetch basemaps. */
  portal?: PortalProperties;
}

/**
 * The PortalBasemapsSource class is a Portal-driven [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/) [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
 * in the [BasemapGalleryViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/) or [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/) widget.
 *
 * @since 4.3
 * @see [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
 * @see [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/)
 * @see [BasemapGalleryViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/)
 */
export default class PortalBasemapsSource extends PortalBasemapsSourceSuperclass {
  constructor(properties?: PortalBasemapsSourceProperties);
  /** A collection of [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/)s fetched from the source's Portal. */
  get basemaps(): Collection<Basemap>;
  /**
   * Function used to filter basemaps after being fetched from the Portal.
   *
   * @example
   * const basemapGallery = new BasemapGallery({
   *    view: view,
   *    source: {
   *      portal: "https://arcgis.com",
   *      // async filterFunction support added at v4.27
   *      filterFunction: async (item, index, basemaps) => {
   *        let bool = true;
   *        await item.load().then((loadedBasemap) => {
   *          // filter out the Oceans basemap
   *          if (loadedBasemap.title == "Oceans") {
   *            bool = false;
   *          }
   *        })
   *        return bool;
   *      }
   *    }
   *  });
   */
  accessor filterFunction: BasemapFilter | null | undefined;
  /** The Portal from which to fetch basemaps. */
  get portal(): Portal;
  set portal(value: PortalProperties);
  /**
   * An object with key-value pairs used to create a custom basemap gallery group query.
   * Note that all parameters will be joined using the `AND` operator.
   * A query string can also be provided for more advanced use cases.
   *
   * @since 4.5
   * @example
   * // query portal basemaps with an object
   * let source = new PortalBasemapsSource({
   *   query: {
   *     title: "United States Basemaps",
   *     owner: "Esri_cy_US"
   *   }
   * });
   * @example
   * // query portal basemaps with a string
   * let source = new PortalBasemapsSource({
   *   query: "title:\"United States Basemaps\" AND owner:Esri_cy_US"
   * });
   */
  accessor query: Record<string, any> | string | null | undefined;
  /**
   * The source's state.
   *
   * @default "not-loaded"
   */
  get state(): BasemapsSourceState;
  /**
   * Callback for updating basemaps after being fetched and filtered. This can be useful if you want
   * to add a custom basemap after fetching the portal basemaps.
   *
   * @since 4.8
   */
  accessor updateBasemapsCallback: UpdateBasemapsCallback | null | undefined;
  /**
   * Refreshes basemaps by fetching them from the Portal.
   *
   * @returns A promise that resolves when the basemaps have been fetched.
   */
  refresh(): Promise<void>;
}
declare const PortalBasemapsSourceSuperclass: typeof LocalBasemapsSource & typeof EsriPromiseMixin & typeof LoadableMixin