import { SupportedCardGalleryItemProps } from './SupportedCardGalleryItemProps';
import { FiltersMap } from '@wix/bex-core';
import { ActionCell } from '../ActionCell';
import { ReactElement } from 'react';
import { AddItemProps, CardGalleryItemProps } from '@wix/design-system';
import type { Preset } from './Grid.types';

export interface GridItemBaseProps<T, F extends FiltersMap> {
  /**
   * A `CardGalleryItem` preset to preserve the same card size regardless of the provided data.
   * Subtitle will be shown only in 'full' or 'footer' presets.
   *
   * @example
   * full — renders title + subtitle
   * title — renders only title
   * empty — renders a card without a footer
   *
   * @default title
   * @external
   */
  preset?: Preset;
  /**
   * A function that renders a custom item of the grid.
   * Returns a WSR [`CardGalleryItemProps`](https://www.docs.wixdesignsystem.com/?path=/story/components-lists--cardgalleryitem) object.
   * @external
   */
  renderItem?: (
    item: T,
    index: number,
  ) => Partial<SupportedCardGalleryItemProps>;
  /**
   * Adds an action on the grid item. For example, a delete button to delete an item.
   * Accepts an [`ActionCellProps`](https://www.docs.wixdesignsystem.com/?path=/story/components-lists-table--tableactioncell) object, or a function that returns an `ActionCellProps` object.
   * @external
   */
  actionCell?: ActionCell<T, F>;

  /**
   * A function that renders [`<AddItem>`](https://www.docs.wixdesignsystem.com/?path=/story/components-actions--additem&activeTab=Description&globals=backgrounds.value:!hex(F8F8F8);backgrounds.grid:false) after all cards in a gallery.
   * <br><br>
   * The `<AddItem>` card will not show when filters are applied unless the filter is defined with the persistent option.
   * @external
   */
  renderAddItem?: () => ReactElement<AddItemProps>;

  /**
   * Sets placement of a background image.
   * @external
   */
  imagePlacement?: CardGalleryItemProps['imagePlacement'];
}
