import type ListItem from "./ListItem.js";

/**
 * A function for customizing a list item as it is created in the table list.
 *
 * @param event - An object containing a list item created by the [TableList](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList.html).
 * @since 5.0
 * @see [TableList.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList.html#listItemCreatedFunction)
 * @see [TableListViewModel.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList-TableListViewModel.html#listItemCreatedFunction)
 */
export type ListItemModifier = (event: ListItemModifierEvent) => void;

/** @since 5.0 */
export interface ListItemModifierEvent {
  /**
   * The event object passed to a listItemCreatedFunction in the layer lists.
   * Provides access to the list item being created, allowing you to customize its properties, actions, panel content, or visibility before rendering.
   *
   * @since 5.0
   * @see [TableList.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList.html#listItemCreatedFunction)
   * @see [TableListViewModel.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList-TableListViewModel.html#listItemCreatedFunction)
   */
  item: ListItem;
}

/**
 * Describes the current state of the list items in the [TableListViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList-TableListViewModel.html).
 *
 * @since 5.0
 * @see [TableListViewModel.state](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TableList-TableListViewModel.html#state)
 */
export type State = "ready" | "loading" | "disabled";