import type Widget from "./Widget.js";
import type AttributionViewModel from "./Attribution/AttributionViewModel.js";
import type { Icon } from "@esri/calcite-components/components/calcite-icon";
import type { MapViewOrSceneView } from "../views/MapViewOrSceneView.js";
import type { WidgetProperties } from "./Widget.js";
import type { AttributionViewModelProperties } from "./Attribution/AttributionViewModel.js";

export interface AttributionProperties extends WidgetProperties, Partial<Pick<Attribution, "itemDelimiter" | "view">> {
  /**
   * Icon which represents the widget. It is typically used when the widget is controlled by another
   * one (e.g. in the Expand widget).
   *
   * @default "description"
   * @since 4.27
   * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/)
   * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/)
   */
  icon?: Icon["icon"] | null;
  /**
   * The widget's default label.
   *
   * @since 4.7
   */
  label?: string | null;
  /**
   * The view model for this widget. This is a class that contains all the logic
   * (properties and methods) that controls this widget's behavior. See the
   * [AttributionViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attribution/AttributionViewModel/) class to access
   * all properties and methods on the widget.
   */
  viewModel?: AttributionViewModelProperties;
}

/**
 * The Attribution widget displays attribution text for the layers in a map.
 * The text displayed for the layers is either a list of data providers
 * or sources as defined in the layer's custom attribution data, or the copyright text.
 * This widget automatically updates based on layer visibility and map extent and
 * displays a single line of attribution that can be expanded with a single click
 * to view all data sources.
 *
 * The attribution text displayed depends on how the layers are added to the map. If the
 * layer is added by:
 * 1. Referencing a layer item in an ArcGIS portal, then the attribution text displayed comes from the
 * [Credits (Attribution)](https://doc.arcgis.com/en/arcgis-online/manage-data/item-details.htm#ESRI_SECTION2_0937A3EF2DE34C279302D93B255EC31F)
 * property of that portal item's details.
 * 2. Referencing a service URL, then the attribution text displayed references the
 * Copyright Text property of the service.
 *
 * An instance of the Attribution widget is available in every
 * [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) and [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) by default.
 * See [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/) for more details.
 *
 * ![attribution](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/attribution.png)
 *
 * > [!WARNING]
 * >
 * > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
 * > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/terms/attribution/) documentation.
 * > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
 *
 * @deprecated since version 5.0. As of 5.0, attribution is handled automatically by the [Map](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/),  [Scene](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scene/), and [Link Chart](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-link-chart/) components, with properties for extracting attribution items, hiding the attribution, as well as setting dark and light mode for the attribution. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 4.0
 * @see [AttributionViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attribution/AttributionViewModel/)
 * @see [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/)
 */
export default class Attribution extends Widget {
  constructor(properties?: AttributionProperties);
  /** Full attribution text. */
  get attributionText(): string;
  /**
   * Icon which represents the widget. It is typically used when the widget is controlled by another
   * one (e.g. in the Expand widget).
   *
   * @default "description"
   * @since 4.27
   * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/)
   * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/)
   */
  get icon(): Icon["icon"];
  set icon(value: Icon["icon"] | null | undefined);
  /**
   * Text used to split attribution by [layers](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)
   *
   * @default " | "
   */
  accessor itemDelimiter: string;
  /**
   * The widget's default label.
   *
   * @since 4.7
   */
  get label(): string;
  set label(value: string | null | undefined);
  /** A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). Set this to link the widget to a specific view. */
  accessor view: MapViewOrSceneView | null | undefined;
  /**
   * The view model for this widget. This is a class that contains all the logic
   * (properties and methods) that controls this widget's behavior. See the
   * [AttributionViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attribution/AttributionViewModel/) class to access
   * all properties and methods on the widget.
   */
  get viewModel(): AttributionViewModel;
  set viewModel(value: AttributionViewModelProperties);
}