import { nothing, type PropertyValues, type TemplateResult } from 'lit';
import { ModelingElement } from './ModelingElement.js';
import type { DomainBrowseRecentItem, DomainBrowserPickItem, DomainBrowserPickReason, DomainBrowseSelectedItem } from '../types.js';
import { type DomainEntity, type DomainModel, type DomainNamespace } from '@api-client/core/browser.js';
import type { TabSelectionDetail } from '../../md/tabs/ui-tabs.js';
interface DomainPartition {
    /**
     * The list of currently rendered items.
     */
    items: (DomainNamespace | DomainModel | DomainEntity)[];
    /**
     * The currently selected item.
     */
    selected?: DomainBrowseSelectedItem;
    /**
     * The parent object, if any
     */
    parent?: DomainNamespace | DomainModel;
}
interface RecentPartition {
    /**
     * The list of recently picked items.
     */
    currentList: DomainBrowseRecentItem[];
    /**
     * The currently selected item.
     */
    selected?: DomainBrowseSelectedItem;
}
/**
 * An element that provides browsing capabilities for a data domain.
 *
 * @fires select - Fired when a domain item is selected or deselected.
 *   The detail contains `DomainBrowseSelectedItem` with the selected item's key, kind,
 *   namespace, and whether it's a parent (can be opened), or `undefined` if deselected.
 */
export default class DomainBrowser extends ModelingElement {
    /**
     * Whether to include recent items in the browsing.
     */
    accessor withRecent: boolean;
    /**
     * The reason to browse the domain.
     */
    accessor reason: DomainBrowserPickReason;
    /**
     * Specifies which items are allowed to select in the UI to return the result
     * back to the application. By default all data domain items are allowed.
     */
    accessor allowed: DomainBrowserPickItem[] | undefined;
    /**
     * The currently selected tab.
     * @default 'domain'
     */
    accessor selectedTab: 'recent' | 'domain';
    /**
     * Whether there is an allowed selection.
     */
    accessor hasAllowedSelection: boolean;
    /**
     * The recent browsing partition state.
     */
    recent: RecentPartition;
    /**
     * The current data domain partition state.
     */
    current?: DomainPartition;
    /**
     * Returns the active browsing partition based on the selected tab.
     */
    get activePartition(): DomainPartition | RecentPartition;
    protected willUpdate(cp: PropertyValues<this>): void;
    protected setupCurrentPartition(): void;
    /**
     * Sets up whether a selection is allowed based on the current state.
     * @param partition - The partition to check.
     */
    protected setupAllowedSelection(partition: DomainPartition | RecentPartition): void;
    /**
     * Updates the current list of items in a browsing domain partition.
     * @param partition - The partition to update.
     */
    protected updateBrowsingDomainList(): void;
    /**
     * Requests the recent items from the context provider if `withRecent` is enabled.
     */
    protected setupRecent(): Promise<void>;
    /**
     * Checks if an item is selected.
     * @param key The key of the item to check.
     * @returns True if the item is selected, false otherwise.
     */
    isSelected(key: string): boolean;
    /**
     * Handles the tab selection event.
     * @param e - The tab selection event.
     */
    protected handleTabSelect(e: CustomEvent<TabSelectionDetail>): void;
    /**
     * Handles the click event to go back to the parent.
     */
    protected handleParentBack(): void;
    /**
     * Selects a parent item.
     *
     * @param partition - The partition to select the parent in.
     * @param key - The key of the parent item.
     * @param kind - The kind of the parent item.
     * @throws {Error} If the root is not set or the item is not found.
     */
    selectParent(partition: DomainPartition, key: string, kind: string, namespace?: string): void;
    /**
     * Handles the click event to open a parent item.
     *
     * @param e - The click event.
     */
    protected handleOpenParent(e: Event): void;
    /**
     * Handles the selection event on a list.
     * @param e The selection event.
     */
    protected handleItemSelect(e: CustomEvent<{
        item: HTMLElement;
    }>): void;
    notifySelected(selected: DomainBrowseSelectedItem | undefined): void;
    render(): TemplateResult | typeof nothing;
    /**
     * Renders the header of the dialog.
     * @private
     */
    protected renderHeader(): TemplateResult | typeof nothing;
    /**
     * Renders the tabs.
     * @private
     */
    protected renderTabs(): TemplateResult;
    /**
     * Renders the parent header.
     * @private
     * @param parent - The parent item.
     */
    protected renderParentHeader(parent: DomainNamespace | DomainModel): TemplateResult;
    /**
     * Renders the recent items.
     * @private
     */
    protected renderRecent(): TemplateResult;
    /**
     * Renders the browsing domain items.
     * @private
     */
    protected renderBrowsingDomain(): TemplateResult | typeof nothing;
    /**
     * Renders the domain items.
     * @private
     * @param items - The items to render.
     */
    protected renderDomainItems(items: (DomainNamespace | DomainModel | DomainEntity)[]): TemplateResult;
    protected renderRecentItems(items: DomainBrowseRecentItem[]): TemplateResult;
    protected renderDomainItem(item: DomainNamespace | DomainModel | DomainEntity): TemplateResult;
    protected renderRecentItem(item: DomainBrowseRecentItem): TemplateResult;
    /**
     * Renders a generic item.
     * @private
     * @param key - The key of the item.
     * @param kind - The kind of the item.
     * @param label - The label of the item.
     * @param {{ noParent?: boolean }} opts - Additional options.
     */
    protected renderItem(key: string, kind: string, label: string, opts?: {
        isParent?: boolean;
        domain?: string;
    }): TemplateResult;
}
export {};
//# sourceMappingURL=DomainBrowser.d.ts.map