/// <reference path="../../library.d.cts" />
/**
 * @file
 *
 * Command handler for abstract file commands with file/files menu integration.
 */
import type { IconName, TAbstractFile, WorkspaceLeaf } from 'obsidian';
import type { Promisable } from 'type-fest';
import type { ActiveFileProvider } from '../active-file-provider.cjs';
import type { CommandHandlerConstructorParams, CommandHandlerRegistrationContext } from './command-handler.cjs';
import { GlobalCommandHandler } from './global-command-handler.cjs';
/**
 * Parameters for creating an abstract file command handler.
 */
export interface AbstractFileCommandHandlerConstructorParams extends CommandHandlerConstructorParams {
    /**
     * The item name to use in the single-file menu.
     */
    readonly fileMenuItemName?: string | undefined;
    /**
     * The section to use in the single-file menu.
     */
    readonly fileMenuSection?: string | undefined;
    /**
     * The icon to use in the single-file menu submenu.
     */
    readonly fileMenuSubmenuIcon?: IconName | undefined;
    /**
     * The item name to use in the multi-file menu.
     */
    readonly filesMenuItemName?: string | undefined;
    /**
     * The section to use in the multi-file menu.
     */
    readonly filesMenuSection?: string | undefined;
    /**
     * The icon to use in the multi-file menu submenu.
     */
    readonly filesMenuSubmenuIcon?: IconName | undefined;
    /**
     * Whether to add the command to a submenu.
     */
    readonly shouldAddCommandToSubmenu?: boolean | undefined;
}
/**
 * Command handler for abstract file commands.
 *
 * Handles both single-file and multi-file context menus.
 * Subclasses override {@link canExecuteAbstractFile} and {@link executeAbstractFile}.
 */
export declare abstract class AbstractFileCommandHandler extends GlobalCommandHandler {
    /**
     * Get the active file provider.
     *
     * @returns The active file provider.
     */
    protected get activeFileProvider(): ActiveFileProvider;
    /**
     * Gets the item name to use in the single-file menu.
     *
     * @returns The item name, or `undefined` to use the command name.
     */
    protected get fileMenuItemName(): string | undefined;
    /**
     * Gets the section to use in the single-file menu.
     *
     * @returns The section name, or `undefined` to use the plugin name.
     */
    protected get fileMenuSection(): string | undefined;
    /**
     * Gets the icon to use in the single-file menu submenu.
     *
     * @returns The icon, or `undefined` for no icon.
     */
    protected get fileMenuSubmenuIcon(): IconName | undefined;
    /**
     * Gets the item name to use in the multi-file menu.
     *
     * @returns The item name, or `undefined` to fall back to single-file item name.
     */
    protected get filesMenuItemName(): string | undefined;
    /**
     * Gets the section to use in the multi-file menu.
     *
     * @returns The section name, or `undefined` to fall back to single-file section.
     */
    protected get filesMenuSection(): string | undefined;
    /**
     * Gets the icon to use in the multi-file menu submenu.
     *
     * @returns The icon, or `undefined` to fall back to single-file submenu icon.
     */
    protected get filesMenuSubmenuIcon(): IconName | undefined;
    private _activeFileProvider?;
    private readonly _fileMenuItemName?;
    private readonly _fileMenuSection?;
    private readonly _fileMenuSubmenuIcon?;
    private readonly _filesMenuItemName?;
    private readonly _filesMenuSection?;
    private readonly _filesMenuSubmenuIcon?;
    private _pluginName?;
    private readonly _shouldAddCommandToSubmenu?;
    private get pluginName();
    /**
     * Creates a new abstract file command handler.
     *
     * @param params - The parameters for the abstract file command handler.
     */
    constructor(params: AbstractFileCommandHandlerConstructorParams);
    /**
     * Registers file-menu and files-menu event handlers.
     *
     * @param context - The registration context.
     */
    onRegistered(context: CommandHandlerRegistrationContext): void;
    /**
     * Checks whether the command can execute from the command palette.
     * Uses the active file as the target.
     *
     * @returns Whether the command can execute.
     */
    protected canExecute(): boolean;
    /**
     * Checks whether the command can execute for a single abstract file.
     *
     * @param _abstractFile - The file or folder.
     * @returns Whether the command can execute.
     */
    protected canExecuteAbstractFile(_abstractFile: TAbstractFile): boolean;
    /**
     * Checks whether the command can execute for multiple abstract files.
     * Default implementation checks each file individually.
     *
     * @param abstractFiles - The files or folders.
     * @returns Whether the command can execute.
     */
    protected canExecuteAbstractFiles(abstractFiles: TAbstractFile[]): boolean;
    /**
     * Executes the command from the command palette using the active file.
     *
     * @returns `Promisable<void>` that resolves when command had been executed.
     */
    protected execute(): Promisable<void>;
    /**
     * Executes the command for a single abstract file.
     *
     * @param abstractFile - The file or folder.
     */
    protected abstract executeAbstractFile(abstractFile: TAbstractFile): Promisable<void>;
    /**
     * Executes the command for multiple abstract files.
     * Default implementation executes sequentially.
     *
     * @param abstractFiles - The files or folders.
     * @returns `Promisable<void>` that resolves when all abstract files have been executed.
     */
    protected executeAbstractFiles(abstractFiles: TAbstractFile[]): Promisable<void>;
    /**
     * Gets the active file, if any, to use as the target when executing from the command palette.
     *
     * @returns The active file or `null` if none is active.
     */
    protected getActiveFile(): null | TAbstractFile;
    /**
     * Gets whether to add the command to a submenu.
     *
     * @returns Whether to add to a submenu.
     */
    protected shouldAddCommandToSubmenu(): boolean | undefined;
    /**
     * Checks whether the command should appear in the single-file context menu.
     *
     * @param _abstractFile - The file or folder.
     * @param _source - The source of the event.
     * @param _leaf - The workspace leaf, if available.
     * @returns Whether to add to the file menu.
     */
    protected shouldAddToAbstractFileMenu(_abstractFile: TAbstractFile, _source: string, _leaf?: WorkspaceLeaf): boolean;
    /**
     * Checks whether the command should appear in the multi-file context menu.
     * Default implementation checks each file individually.
     *
     * @param abstractFiles - The files or folders.
     * @param source - The source of the event.
     * @param leaf - The workspace leaf, if available.
     * @returns Whether to add to the files menu.
     */
    protected shouldAddToAbstractFilesMenu(abstractFiles: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): boolean;
    /**
     * Checks whether the command should appear in the command palette.
     *
     * @returns Whether to add to the command palette.
     */
    protected shouldAddToCommandPalette(): boolean;
    private handleAbstractFileMenu;
    private handleAbstractFilesMenu;
}
