import type Basemap from "@arcgis/core/Basemap.js";
import type Ground from "@arcgis/core/Ground.js";
import type Layer from "@arcgis/core/layers/Layer.js";
import type WebMap from "@arcgis/core/WebMap.js";
import type WebScene from "@arcgis/core/WebScene.js";
import type WebLinkChart from "@arcgis/core/WebLinkChart.js";
import type SceneView from "@arcgis/core/views/SceneView.js";
import type MapView from "@arcgis/core/views/MapView.js";
import type LinkChartView from "@arcgis/core/views/LinkChartView.js";
import type { ArcgisLinkChart } from "./arcgis-link-chart/customElement.js";
import type { ArcgisMap } from "./arcgis-map/customElement.js";
import type { ArcgisScene } from "./arcgis-scene/customElement.js";
import type { GoToOptions2D, GoToOptions3D, GoToTarget2D, GoToTarget3D } from "@arcgis/core/views/types.js";
import type { Icon as Icon } from "@esri/calcite-components/components/calcite-icon";

export type ArcgisReferenceElement = ArcgisLinkChart | ArcgisMap | ArcgisScene;

export type IconName = Icon["icon"];

export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;

/** A potential source of load errors. */
export type LoadErrorSource = Basemap | Ground | Layer | WebLinkChart | WebMap | WebScene;

/**
 * @param view
 * @param goToParameters
 */
export type GoToOverride = (view: ArcGISView & GoToOwner, goToParameters: GoToParameters) => Promise<void>;

export type GoToOwner = Pick<LinkChartView, "goTo">
  & Pick<MapView, "goTo">
  & Pick<SceneView, "goTo">;

export type ArcGISView = LinkChartView | MapView | SceneView;

export type GoToParameters = GoToParameters2D
  & GoToParameters3D;

export interface GoToParameters2D {
  /**
   * The target location/viewpoint/extent to animate to.
   *
   * @since 5.0
   */
  target: GoToTarget2D;
  /**
   * Options defining the animation and duration of the navigation.
   *
   * @since 5.0
   */
  options?: GoToOptions2D;
}

export interface GoToParameters3D {
  target: GoToTarget3D;
  options?: GoToOptions3D;
}