import { IconElement, PopoverMenuProps } from '@wix/design-system';

export type ActionSubitem = {
  /**
   * A callback that runs each time the button is clicked.
   * @external
   */
  onClick?: any;
  /**
   * Button label.
   * @external
   */
  label?: string;
  /**
   * Button subtitle. Relevant for buttons inside the popover.
   * @external
   */
  subtitle?: string;
  /**
   * An optional Icon prefix.
   * @external
   */
  prefixIcon?: IconElement;
  /**
   * An optional tooltip when the popover is disabled.
   * @external
   */
  tooltip?: string;
  /**
   * An optional disabled flag.
   * @external
   */
  disabled?: boolean;
  /**
   *  A data-hook for the button.
   * @external
   */
  dataHook?: string;
  /**
   * A unique name for cairoPageCtaClicked BI event. For example: 'edit'.
   */
  biName?: string;
  /**
   * Additional info for cairoPageCtaClicked BI event.
   */
  biAdditionalInfo?: string;
  /**
   * Array of action items to render in a popover menu. Actions can be grouped by using an array of arrays, and a divider will be added between each group.
   * @overrideType [ActionSubitem[]](./?path=/story/common-types--actionsubitem) | [ActionSubitem[][]](./?path=/story/common-types--actionsubitem)
   * @external
   */
  subItems?: ActionSubitem[] | ActionSubitem[][];
  /**
   * Custom [PopoverMenuProps](https://www.docs.wixdesignsystem.com/?path=/story/components-overlays--popovermenu) to pass to the sub-items popover menu
   * @external
   */
  popoverMenuProps?: Partial<PopoverMenuProps>;
};

export type MultiBulkActionSubItem = ActionSubitem;

export type ActionSubItemPrivate = Omit<ActionSubitem, 'subItems'> & {
  subItems?: (ActionSubitem & {
    componentId?: string;
    appId?: string;
  })[][];
};
