/**
 * Object containing helper methods for getting optimal symbol schemes used
 * to create [relationship (bivariate choropleth) visualizations](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-relationship.html).
 * The [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-symbology-relationship.html#getSchemes) returns color schemes best suited to the given basemap for this visualization style.
 *
 * @since 4.9
 */
import type Basemap from "../../Basemap.js";
import type SceneView from "../../views/SceneView.js";
import type { RelationshipSchemes, RelationshipScheme, BasemapTheme, Theme } from "./types.js";

/**
 * Returns metadata for the available themes. If a basemap is provided, returns themes that work best
 * with the given basemap.
 *
 * @param basemap - The [Esri basemap string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap)
 *   or object that will be used with the returned theme(s).
 * @returns Returns an object containing information about the available themes for the given basemap.
 */
export function getThemes(basemap?: Basemap | string): Theme[];

/**
 * Returns a primary scheme and secondary schemes defining symbol properties for relationship-based (bivariate choropleth)
 * data-driven visualizations in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The `basemap` parameter determines the color of the
 * symbols used to visualize each feature. The `geometryType` determines which type of symbol to return.
 *
 * @param params - See the table below for details of each parameter that may be passed to this function.
 * @returns Returns an object containing
 *   the optimal relationship color scheme to use for the given basemap; it also contains secondary schemes.
 * @example
 * // gets the primary scheme for the features of the given geometry type and basemap
 * const schemes = relationshipSchemes.getSchemes({
 *   basemap: map.basemap,
 *   geometryType: featureLayer.geometryType
 * });
 *
 * // the best default scheme for the layer and basemap
 * const primaryScheme = schemes.primaryScheme;
 */
export function getSchemes(params: GetSchemesParameters): RelationshipSchemes | null | undefined;

/**
 * Returns a relationship scheme with the provided name.
 *
 * @param params - See the table below for details of each parameter that may be passed to this function.
 * @returns Returns the relationship scheme
 *   with the given name.
 * @since 4.12
 * @example
 * // Returns the Blueberry Parfait scheme
 * let blueberryScheme = relationshipSchemes.getSchemeByName({
 *   basemap: map.basemap,
 *   geometryType: featureLayer.geometryType,
 *   name: "Blueberry Parfait"
 * });
 */
export function getSchemeByName(params: GetSchemesByNameParameters): RelationshipScheme | null | undefined;

/**
 * Returns an array of relationship schemes with the provided tags. These schemes define symbol properties for
 * relationship visualizations.
 *
 * @param params - See the table below for details of each parameter that may be passed to this function.
 * @returns Returns an array of relationship schemes
 *   either including or excluding the provided tags.
 * @since 4.12
 * @example
 * let schemes = relationshipSchemes.getSchemesByTag({
 *   basemap: map.basemap,
 *   geometryType: featureLayer.geometryType,
 *   includedTags: [ "tritanopia" ],
 *   excludedTags: [ "grayscale" ]
 * });
 */
export function getSchemesByTag(params: GetSchemesByTagParameters): RelationshipScheme[];

/**
 * Clones a relationship (bivariate color) scheme object.
 *
 * @param scheme - The relationship scheme object to clone.
 * @returns Returns a clone of the given relationship scheme object.
 * @example
 * // clones the primary scheme returned from the getSchemes() method
 * const relationshipScheme = primaryScheme.clone();
 */
export function cloneScheme(scheme: RelationshipScheme | null | undefined): RelationshipScheme | null | undefined;

export interface GetSchemesParameters {
  /**
   * The Esri basemap to pair with the visualization. This
   *   value indicates the best symbol colors for visualizing features against the given basemap. If you have a
   *   non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, then use the `basemapTheme` parameter
   *   instead of this parameter.
   */
  basemap?: Basemap | string | null;
  /**
   * If you have a
   *   non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, use this parameter to indicate
   *   whether the background of the visualization is `light` or `dark`.
   */
  basemapTheme?: BasemapTheme | null;
  /** The geometry type of the features to visualize. */
  geometryType: "point" | "multipoint" | "polyline" | "polygon" | "mesh" | "multipatch" | null;
  /**
   * Determines which set of primary and secondary color schemes to return.
   *
   * @default default
   */
  theme?: "default" | null;
  /**
   * The SceneView instance in which the scheme
   *   will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols.
   */
  view?: SceneView | null;
  /**
   * Indicates if the size units of the scheme will be in meters.
   *   This should be `true` when the scheme is intended for 3D volumetric symbology.
   *   A `view` must be provided if this property is set to `true`.
   */
  worldScale?: boolean | null;
}

export interface GetSchemesByNameParameters extends GetSchemesParameters {
  /** The name of the scheme to retrieve. */
  name: string;
}

export interface GetSchemesByTagParameters extends GetSchemesParameters {
  /**
   * When provided, only schemes missing all the provided tags will be returned.
   *
   * **Known Tags:** light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays |
   * bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density
   */
  excludedTags?: string[] | null;
  /**
   * When provided, only schemes containing all the matching tags will be returned.
   *
   * **Known Tags:** light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays |
   * bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density
   */
  includedTags?: string[] | null;
}