/* eslint-disable @typescript-eslint/no-explicit-any */
import { DefineComponent } from 'vue';
import { MenuOption } from '../Menu/Menu.vue.d';

export interface ButtonBulkActionProps {
  /**
   * Disable the button.
   */
  disabled?: boolean;
  /**
   * An array of data objects to be included in an action.
   * Use as 'v-model:selectedData' to automatically reset on Cancel or Apply.
   */
  selectedData: Record<string, any>[];
  options: MenuOption[];
  /**
   * Specify the name/label for selected data.
   * @example 'Asset(s)' will be displayed as '3 Asset(s) Selected'
   */
  naming?: string;
  /**
   * Multiple bulk action mounted at the same time will cause unexpected behavior.
   *
   * You need to set the appropiate id the same with the table-name where the bulkaction used for.
   */
  tableName?: string;
  /**
   * Multiple bulk action mounted at the same time will cause unexpected behavior.
   *
   * You need to set the appropiate id the same with the table-name where the bulkaction used for.
   *
   * @deprecated - will be removed on future update - use tabelName instead.
   */
  for?: string;
  /**
   * Hide or show the button select all.
   * @default true
   */
  showSelectAllButton?: boolean;
  /**
   * Define wheter use this component with its bulk action button or not
   * @default true
   */
  useButton?: boolean;
}

export interface ButtonBulkActionSlots {
  /**
   * Use additional slot like input field.
   * The button Apply will shown if the selected option use additional slot.
   *
   * @slotprops selectedOption the current selected option/action. you can do conditional based on this slotprops.
   */
  addition(selectedOption: MenuOption): () => any;
}

export type ButtonBulkActionEmits = {
  /**
   * Emits when Apply button is clicked.
   *
   * By default 'command' on MenuOption will be executed.
   * With this event, You can do additional actions.
   */
  'apply': [];
  /**
   * Emits when Cancel or Apply button is clicked.
   */
  'update:selectedData': [datas: Record<string, unknown>[]];
};

/**
 * **TSVue V2 - ButtonBulkAction**
 *
 * _ButtonBulkAction is a component for handling bulk action for multiple data at once._
 *
 * --- ---
 * ![TSVue](https://ik.imagekit.io/kurniadev/TS-HEAD-BLACK.png)
 *
 * @group buttons
 */
declare const ButtonBulkAction: DefineComponent<
  ButtonBulkActionProps,
  ButtonBulkActionSlots,
  ButtonBulkActionEmits
>;

export default ButtonBulkAction;
