import { BaseApplication, NavItem, WorkspaceStateManager } from '@memberjunction/ng-base-application';
import { SharedService } from '@memberjunction/ng-shared';
/**
 * Home Application - Provides dynamic navigation items for orphan resources.
 *
 * Maintains a recency-ordered stack of up to 3 recently visited orphan resources.
 * When the user opens a record/view/dashboard from within the Home app, the resource
 * appears as a dynamic nav item. When they navigate away (e.g., click Home), the
 * nav item persists so they can quickly jump back. Older items drop off as new ones
 * are added.
 *
 * The stack is persisted to localStorage (via Metadata.Provider.LocalStorageProvider)
 * so it survives page reloads. Resolved record labels are stored alongside each
 * snapshot to avoid async lookups when restoring from storage.
 *
 * @example
 * User opens "John Smith" contact, then "Acme Corp" company:
 * - Nav shows: [Home] [Favorites] | [person] "Acme Corp" [building] "John Smith"
 * - Clicking "John Smith" re-opens that record
 */
export declare class HomeApplication extends BaseApplication {
    private static readonly MAX_RECENT_ITEMS;
    private workspaceManager;
    private sharedService;
    private recentOrphanStack;
    private _storageLoadPromise;
    /**
     * Fingerprint of the last-processed active tab state (tabId::resourceRecordId).
     * Guards against redundant stack mutations while still detecting content changes.
     * In single-resource mode the tab ID stays constant when navigating between records
     * (OpenTab replaces the temp tab's content but keeps its ID), so we must also
     * include the resourceRecordId to detect when the tab shows a different record.
     */
    private _lastSeenTabFingerprint;
    /**
     * Inject WorkspaceStateManager for accessing current tab state.
     * Also triggers loading the persisted stack from storage on first call.
     */
    SetWorkspaceManager(manager: WorkspaceStateManager): void;
    /**
     * Inject SharedService for accessing ResourceTypes metadata
     */
    SetSharedService(service: SharedService): void;
    /**
     * Returns navigation items including dynamic items for recently visited orphan resources.
     * Static items come from DefaultNavItems in metadata.
     * Dynamic items are generated from the recent orphan stack (up to 3).
     */
    GetNavItems(): Promise<NavItem[]>;
    /**
     * Removes a dynamic nav item from the recent stack by RecordID.
     * Called by AppNavComponent when the user clicks the dismiss X button.
     * If the dismissed item is currently active, navigates back to the app's default tab.
     */
    RemoveDynamicNavItem(item: NavItem): void;
    /**
     * Checks whether the dismissed nav item matches the currently active tab.
     */
    private isDismissedItemActive;
    /**
     * Navigates back to the app's default tab (first static nav item / Home dashboard).
     */
    private navigateToDefault;
    /**
     * Resolves the best icon for a dynamic nav item.
     * Priority: entity-specific icon from metadata → resource type icon → generic fallback.
     */
    private resolveIcon;
    /**
     * Updates the recent orphan stack based on the currently active tab.
     * If the active tab is a new orphan resource (not already in the stack and not
     * matching any static nav item), it gets added to the front. Items already in the
     * stack keep their position to avoid visually jarring reordering when users click
     * between existing dynamic nav items.
     */
    private updateRecentStack;
    /**
     * Creates an OrphanResourceSnapshot from a tab if it qualifies as an orphan resource.
     * Returns null if the tab is a static nav item, has no resource type, or is an
     * app-level custom dashboard (no record ID).
     */
    private createSnapshotIfOrphan;
    /**
     * Checks whether a tab matches any static nav item (by label, route, or driver class).
     */
    private matchesStaticNavItem;
    /**
     * Creates DynamicNavItem entries for each item in the recent orphan stack.
     * Uses the pre-resolved label from the snapshot (no async needed).
     */
    private buildDynamicNavItems;
    /**
     * Creates a single DynamicNavItem from an OrphanResourceSnapshot.
     * Uses the snapshot's resolvedLabel directly — no async lookup needed.
     */
    private createDynamicNavItem;
    /**
     * Resolves the best available display label for an entity record nav item.
     * Priority order:
     *   1. Cached record name (from EntityRecordNameCache, populated by entity Load/Save)
     *   2. Tab title (whatever the workspace assigned when the tab was opened)
     *   3. Generated default (entity name + truncated primary key values)
     *
     * @param entityName - Entity name from tab configuration, may be undefined for non-entity resources
     * @param tabRecordId - URL-encoded composite key segment (e.g. "ID|abc-123" or "Field1|val1||Field2|val2")
     * @param tabTitle - Fallback title assigned by the workspace when the tab was opened
     */
    private resolveRecordLabel;
    /**
     * Generates a fallback label when no cached record name or tab title is available.
     * Format: "EntityName: <truncated key value(s)>"
     *
     * @example
     * // Single key:  "Contacts: abc1234..."
     * // Multi key:   "Order Details: abc1..., 42"
     * // No key:      "Contacts record"
     */
    private createDefaultLabel;
    /**
     * Truncates a primary key value for display, appending "..." if it exceeds maxLength.
     * Returns the value as-is if it's short enough or empty.
     */
    private trimValue;
    /**
     * Persists the current recentOrphanStack to localStorage via Provider.
     * Fire-and-forget — errors are logged but don't affect the UX.
     */
    private saveStackToStorage;
    /**
     * Loads the recent orphan stack from localStorage via Provider.
     * Filters out stale entries (older than MAX_SNAPSHOT_AGE_MS).
     */
    private loadStackFromStorage;
}
//# sourceMappingURL=home-application.d.ts.map