import { LitElement, nothing, TemplateResult } from 'lit';
import type { FilesSource } from '../../../data/FilesModel.js';
import { type FileBreadcrumb, type IFile } from '@api-client/core/models/store/File.js';
import type { LiveData } from '../../../reactive/LiveData.js';
import { type IOrganization } from '../../../providers/organization.js';
import { type IUser } from '../../../providers/user.js';
import type { UiMenuItemElement } from '../../../md/menu/ui-menu-item.js';
import '../../../md/icons/ui-icon.js';
import '../../../md/icon-button/ui-icon-button.js';
import '../../../md/button/ui-button.js';
import '../../../md/divider/ui-divider.js';
import '../../../md/menu/ui-menu.js';
import '../../../md/menu/ui-menu-item.js';
import '../ui-breadcrumbs.js';
import '../../data-table/filesystem-table.js';
export interface QuickApiFilesystemOpenFolderDetails {
    /**
     * The key of the folder to open.
     * When not set, it opens the root folder.
     */
    key?: string;
}
export interface QuickApiFilesystemOpenFileDetail {
    /**
     * The key of the file to open.
     */
    key: string;
    /**
     * The kind of the file to open.
     */
    kind: string;
}
export interface QuickApiFilesystemFilesDetail {
    /**
     * The keys of files to process.
     */
    keys: string[];
}
export interface QuickApiFilesystemFileActionDetail {
    /**
     * The key of the file.
     */
    key: string;
}
export interface QuickApiFilesystemFileCreateDetail {
    /**
     * The action to perform from the "add file" menu.
     */
    action: 'folder' | 'api' | 'domain' | 'import';
}
/**
 * The supported file actions.
 */
export type FileAction = 'rename' | 'move' | 'delete' | 'share' | 'open';
/**
 * A component that renders a file system view.
 * It supports listing files, navigating folders, and performing actions on files.
 *
 * The whole logic related to querying files, manipulating them, requesting breadcrumbs
 * or a parent folder is delegated to the parent component or a controller.
 *
 * @fires open-folder - Dispatched when a folder is opened.
 * @fires open-file - Dispatched when a file is opened.
 * @fires share-files - Dispatched when files are shared.
 * @fires file-rename - Dispatched when a file is renamed.
 * @fires file-move - Dispatched when a file is moved.
 * @fires file-create - Dispatched when a file create action is triggered.
 * @fires delete-files - Dispatched when files are deleted.
 * @fires scroll-end - Dispatched when the scroll end on the data table is reached.
 */
export default class QuickApiFilesystem extends LitElement {
    /**
     * What kind of files we render.
     * @attribute
     */
    accessor source: FilesSource;
    /**
     * The currently selected organization, if any.
     *
     * This property consumes the `organizationContext`.
     */
    accessor organization: IOrganization | undefined;
    /**
     * The user object to use with the file system.
     *
     * This property consumes the `userContext`.
     */
    accessor user: IUser | undefined;
    /**
     * The list of files to render.
     */
    accessor files: LiveData<IFile[]> | undefined;
    /**
     * The breadcrumbs to render.
     */
    accessor breadcrumbs: LiveData<FileBreadcrumb[]> | undefined;
    /**
     * The parent folder of the current view.
     * It is used to compute the permissions for the current view.
     */
    accessor parent: LiveData<IFile> | undefined;
    /**
     * The list of currently selected items.
     */
    accessor selectedItems: IFile[];
    /**
     * Dispatches the `open-folder` event.
     *
     * @param key The key of the folder to open.
     */
    protected openFolder(key?: string): void;
    /**
     * Dispatches the `open-file` event.
     *
     * @param file The file to open.
     */
    protected openFile(file: IFile): void;
    /**
     * Dispatches the `share-files` event.
     *
     * @param files The list of files to share.
     */
    protected shareFiles(files: IFile[]): void;
    /**
     * Handler for the item activation event from the data table.
     * Depending on the item kind it opens the folder or the file.
     *
     * @param e The activation event.
     * @throws {Error} When the item kind is unknown.
     */
    protected itemActivateHandler(e: CustomEvent<IFile>): void;
    /**
     * Handler for the selection event from the data table.
     * Updates the `selectedItems` state.
     *
     * @param e The selection event.
     */
    protected handleTableSelect(e: CustomEvent<{
        selectedItems: IFile[];
    }>): void;
    /**
     * Clears the current selection.
     */
    clearSelection(): void;
    /**
     * Shares the currently selected files.
     */
    shareSelection(): void;
    /**
     * Removes files from the selection.
     * @param keys The keys of the files to remove from the selection.
     */
    removeFromSelection(keys: string[]): void;
    /**
     * Logic to handle file actions from the data table (e.g. rename, delete, share, open).
     *
     * @param e The file action event.
     */
    protected handleFileAction(e: CustomEvent<{
        key: string;
        action: string;
    }>): void;
    /**
     * Handler for the "add file" menu selection.
     * Dispatches the `file-create` event.
     *
     * @param e The menu selection event.
     */
    protected handleAddMenuSelect(e: CustomEvent<{
        item: UiMenuItemElement;
    }>): void;
    /**
     * Handler for the breadcrumbs navigation event.
     * Opens the folder corresponding to the breadcrumb.
     *
     * @param e The breadcrumb navigation event.
     */
    protected handleBreadcrumbsNavigate(e: CustomEvent<FileBreadcrumb>): void;
    /**
     * Deletes the currently selected files.
     */
    protected handleDeleteSelected(): void;
    /**
     * Deletes a list of files identified by their keys.
     * Dispatches the `delete-files` event and removes the files from the selection.
     *
     * @param keys The keys of the files to delete.
     */
    deleteFiles(keys: string[]): Promise<void>;
    protected handleScrollEnd(): void;
    protected render(): TemplateResult;
    protected renderSelection(selected: IFile[]): TemplateResult;
    protected renderHeader(): TemplateResult;
    protected renderBreadcrumbs(): TemplateResult;
    protected renderAddFileMenu(): TemplateResult | typeof nothing;
}
//# sourceMappingURL=QuickApiFilesystem.d.ts.map