import { HoverPosition } from './hoverWidget.js';
import { IHoverWidget, IUpdatableHoverOptions } from './updatableHoverWidget.js';
import { IMarkdownString } from '../../../common/htmlContent.js';
import { IDisposable } from '../../../common/lifecycle.js';

interface IHoverDelegateTarget extends IDisposable {
    readonly targetElements: readonly HTMLElement[];
    x?: number;
}
interface IHoverDelegateOptions extends IUpdatableHoverOptions {
    /**
     * The content to display in the primary section of the hover. The type of text determines the
     * default `hideOnHover` behavior.
     */
    content: IMarkdownString | string | HTMLElement;
    /**
     * The target for the hover. This determines the position of the hover and it will only be
     * hidden when the mouse leaves both the hover and the target. A HTMLElement can be used for
     * simple cases and a IHoverDelegateTarget for more complex cases where multiple elements and/or a
     * dispose method is required.
     */
    target: IHoverDelegateTarget | HTMLElement;
    /**
     * The container to pass to {@link IContextViewProvider.showContextView} which renders the hover
     * in. This is particularly useful for more natural tab focusing behavior, where the hover is
     * created as the next tab index after the element being hovered and/or to workaround the
     * element's container hiding on `focusout`.
     */
    container?: HTMLElement;
    /**
     * Options that defines where the hover is positioned.
     */
    position?: {
        /**
         * Position of the hover. The default is to show above the target. This option will be ignored
         * if there is not enough room to layout the hover in the specified position, unless the
         * forcePosition option is set.
         */
        hoverPosition?: HoverPosition;
    };
    appearance?: {
        /**
         * Whether to show the hover pointer
         */
        showPointer?: boolean;
        /**
         * Whether to skip the fade in animation, this should be used when hovering from one hover to
         * another in the same group so it looks like the hover is moving from one element to the other.
         */
        skipFadeInAnimation?: boolean;
    };
}
interface IHoverDelegate {
    showHover(options: IHoverDelegateOptions, focus?: boolean): IHoverWidget | undefined;
    onDidHideHover?: () => void;
    delay: number;
    placement?: 'mouse' | 'element';
    showNativeHover?: boolean;
}

export type { IHoverDelegate, IHoverDelegateOptions, IHoverDelegateTarget };
