import { OnInit, OnDestroy, ChangeDetectorRef, ElementRef, NgZone } from '@angular/core';
import { Router } from '@angular/router';
import { BaseResourceComponent, NavigationService } from '@memberjunction/ng-shared';
import { QueryInfo, QueryCategoryInfo } from '@memberjunction/core';
import { ResourceData } from '@memberjunction/core-entities';
import { QueryEntityLinkClickEvent, QueryRowClickEvent } from '@memberjunction/ng-query-viewer';
import { CompositionTokenClickEvent } from '@memberjunction/ng-code-editor';
import * as i0 from "@angular/core";
/**
 * Tree node for the query category hierarchy
 */
interface CategoryNode {
    category: QueryCategoryInfo;
    children: CategoryNode[];
    queries: QueryInfo[];
    expanded: boolean;
    level: number;
}
/**
 * A resource component for browsing and executing stored queries.
 * Features:
 * - Hierarchical category navigation
 * - Query search
 * - Query viewer with parameter input
 * - Entity linking for clickable record IDs
 */
export declare class QueryBrowserResourceComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    private cdr;
    private navigationService;
    private router;
    private elementRef;
    private zone;
    private static readonly SETTINGS_KEY;
    private static readonly STATUS_FILTERS_KEY;
    private static readonly EXPANDED_STATE_KEY;
    private static readonly DEFAULT_PANEL_WIDTH;
    private static readonly MIN_PANEL_WIDTH;
    private static readonly MAX_PANEL_WIDTH;
    isLoading: boolean;
    categories: QueryCategoryInfo[];
    categoryTree: CategoryNode[];
    /** All queries the user has permission to run */
    queries: QueryInfo[];
    filteredQueries: QueryInfo[];
    private filteredQueryIds;
    selectedQuery: QueryInfo | null;
    searchText: string;
    PanelWidth: number;
    IsResizing: boolean;
    /** Status filter toggles — which statuses to show in the tree */
    StatusFilters: Record<string, boolean>;
    /** Ordered list of all possible statuses for the filter bar */
    readonly AllStatuses: string[];
    /** Tracks expanded state by category ID — persisted across sessions */
    private expandedState;
    private metadata;
    private destroy$;
    private dataLoaded;
    private skipUrlUpdate;
    private lastNavigatedUrl;
    private boundOnResizeMove;
    private boundOnResizeEnd;
    ShowQueryDrawer: boolean;
    DrawerMode: 'create' | 'edit';
    DrawerQueryId: string | null;
    DrawerName: string;
    DrawerSQL: string;
    private drawerSqlEditor;
    DrawerDescription: string;
    DrawerCategoryID: string;
    DrawerStatus: 'Pending' | 'Approved' | 'Rejected' | 'Expired';
    IsSavingDrawer: boolean;
    DrawerNameError: boolean;
    DrawerSaveError: string | null;
    /** Ordered status options for the drawer dropdown — all valid Query statuses */
    readonly DrawerStatuses: Array<'Pending' | 'Approved' | 'Rejected' | 'Expired'>;
    private initialDrawerSnapshot;
    constructor(cdr: ChangeDetectorRef, navigationService: NavigationService, router: Router, elementRef: ElementRef, zone: NgZone);
    ngOnInit(): void;
    ngOnDestroy(): void;
    GetResourceDisplayName(data: ResourceData): Promise<string>;
    GetResourceIconClass(data: ResourceData): Promise<string>;
    private loadData;
    private buildCategoryTree;
    onSearchChange(value: string): void;
    clearSearch(): void;
    /** Toggle a status filter on/off and rebuild the tree */
    toggleStatusFilter(status: string): void;
    /** Get the count of queries with a given status */
    getStatusCount(status: string): number;
    /** Get the CSS color for a query status */
    getStatusColor(status: string): string;
    /** Get the Font Awesome icon for a query status */
    getStatusIcon(status: string): string;
    /** Apply both status and search filters to produce filteredQueries */
    private applyFilters;
    /** Load saved status filter preferences */
    private loadSavedStatusFilters;
    /** Save status filter preferences with debouncing */
    private saveStatusFilters;
    /** Load saved expanded/collapsed state for category nodes */
    private loadSavedExpandedState;
    /** Save expanded/collapsed state with debouncing */
    private saveExpandedState;
    toggleExpand(node: CategoryNode, event?: Event): void;
    expandAll(): void;
    collapseAll(): void;
    selectQuery(query: QueryInfo, event?: Event): void;
    isQueryVisible(query: QueryInfo): boolean;
    hasVisibleContent(node: CategoryNode): boolean;
    onEntityLinkClick(event: QueryEntityLinkClickEvent): void;
    onRowDoubleClick(event: QueryRowClickEvent): void;
    onOpenQueryRecord(event: {
        queryId: string;
        queryName: string;
    }): void;
    onCompositionTokenClick(event: CompositionTokenClickEvent): void;
    /**
     * Find a query by its composition path (e.g., "Demos/Active Users").
     * Matches the last segment as query name and preceding segments as category hierarchy.
     */
    private findQueryByCompositionPath;
    /**
     * Expand category tree nodes to reveal a specific query.
     */
    private expandTreeToQuery;
    /** True when the current user has permission to create new queries. */
    get CanCreateQuery(): boolean;
    /** True when the current user has permission to edit queries. */
    get CanEditQuery(): boolean;
    /** Close the drawer when Escape is pressed (if open). */
    OnEscapeKey(): void;
    /** Open the drawer in create mode. */
    OpenCreateDrawer(): void;
    /**
     * Open the drawer in edit mode, pre-populated from a QueryInfo.
     * Stops event propagation so clicking the edit icon doesn't also select the query.
     */
    OpenEditDrawer(query: QueryInfo, event?: Event): void;
    /**
     * Close the drawer. If dirty, ask for confirmation unless force=true.
     */
    CloseDrawer(force?: boolean): void;
    /** Close drawer when clicking the backdrop. */
    OnDrawerBackdropClick(): void;
    /** Update DrawerSQL when the code editor emits a change. */
    OnDrawerSQLChange(value: string): void;
    private get currentDrawerSnapshot();
    private captureDrawerSnapshot;
    get IsDrawerDirty(): boolean;
    /** Save the drawer form (create or edit). */
    SaveDrawer(): Promise<void>;
    /** Open the full entity form in a new tab (for sub-entity management). */
    OpenFullRecord(): void;
    getTotalQueryCount(): number;
    getNodeQueryCount(node: CategoryNode): number;
    refresh(): void;
    trackByCategory(index: number, node: CategoryNode): string;
    trackByQuery(index: number, query: QueryInfo): string;
    /**
     * Parse URL query string for query state.
     * Query params: queryId
     */
    private parseUrlState;
    /**
     * Update URL query string to reflect current state.
     * Uses NavigationService for proper URL management that respects app-scoped routes.
     */
    private updateUrl;
    /**
     * Handle external navigation (back/forward buttons).
     * Parses the URL and applies the state without triggering a new navigation.
     */
    private onExternalNavigation;
    /**
     * Parse URL state from a URL string (used for external navigation).
     */
    private parseUrlFromString;
    /**
     * Expands the category tree to show the given query
     */
    private expandCategoryForQuery;
    /**
     * Load saved panel width from user settings
     */
    private loadSavedPanelWidth;
    /**
     * Start resizing the left panel via drag handle
     */
    onResizeStart(event: MouseEvent): void;
    private onResizeMove;
    private onResizeEnd;
    /** Case-insensitive UUID check whether a query is the currently selected query. */
    IsQuerySelected(query: QueryInfo): boolean;
    static ɵfac: i0.ɵɵFactoryDeclaration<QueryBrowserResourceComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<QueryBrowserResourceComponent, "mj-query-browser-resource", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=query-browser-resource.component.d.ts.map