import { IContextMenuDelegate } from '../../../base/browser/contextmenu.js';
import { StandardMouseEvent } from '../../../base/browser/mouseEvent.js';
import { IAnchor, AnchorAlignment, AnchorAxisAlignment } from '../../../base/browser/ui/contextview/contextview.js';
import { IAction } from '../../../base/common/actions.js';
import { IDisposable } from '../../../base/common/lifecycle.js';
import { MenuId, IMenuActionOptions } from '../../actions/common/actions.js';
import { IContextKeyService } from '../../contextkey/common/contextkey.service.js';

interface IContextViewDelegate {
    canRelayout?: boolean;
    /**
     * The anchor where to position the context view.
     * Use a `HTMLElement` to position the view at the element,
     * a `StandardMouseEvent` to position it at the mouse position
     * or an `IAnchor` to position it at a specific location.
     */
    getAnchor(): HTMLElement | StandardMouseEvent | IAnchor;
    render(container: HTMLElement): IDisposable;
    onDOMEvent?(e: any, activeElement: HTMLElement): void;
    onHide?(data?: any): void;
    focus?(): void;
    anchorAlignment?: AnchorAlignment;
    anchorAxisAlignment?: AnchorAxisAlignment;
    layer?: number;
}
type IContextMenuMenuDelegate = {
    /**
     * The MenuId that should be used to populate the context menu.
     */
    menuId?: MenuId;
    /**
     * Optional options how menu actions are invoked
     */
    menuActionOptions?: IMenuActionOptions;
    /**
     * Optional context key service which drives the given menu
     */
    contextKeyService?: IContextKeyService;
    /**
     * Optional getter for extra actions. They will be prepended to the menu actions.
     */
    getActions?(): IAction[];
} & Omit<IContextMenuDelegate, 'getActions'>;

export type { IContextMenuMenuDelegate, IContextViewDelegate };
