import { OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { MJAPIKeyEntity, ResourceData } from '@memberjunction/core-entities';
import { TabConfig } from '@memberjunction/ng-ui-components';
import { Subject } from 'rxjs';
import { APIKeyFilter, APIKeyListComponent } from './api-key-list.component';
import { APIKeyCreateResult } from './api-key-create-dialog.component';
import * as i0 from "@angular/core";
/** Activity types for recent activity display */
type ActivityAction = 'Created' | 'Updated' | 'Revoked' | 'Used' | 'Extended';
/** Interface for recent activity items */
interface ActivityItem {
    keyLabel: string;
    action: ActivityAction;
    user: string;
    date: Date;
    keyId: string;
}
/** Interface for scope statistics */
interface ScopeStat {
    category: string;
    count: number;
    percentage: number;
    color: string;
    iconClass: string;
}
/** Current view type */
type ViewType = 'overview' | 'list';
/** Main tab type */
type MainTab = 'keys' | 'applications' | 'scopes' | 'usage';
/**
 * API Keys Resource Component
 * Provides management interface for MJ API Keys including:
 * - Overview statistics and health monitoring
 * - Key listing with status filters
 * - Key creation and revocation
 * - Usage tracking and analytics
 */
export declare class APIKeysResourceComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    keyListComponent: APIKeyListComponent | undefined;
    protected destroy$: Subject<void>;
    private md;
    private cdr;
    CurrentView: ViewType;
    ListFilter: APIKeyFilter;
    MainTab: MainTab;
    ApplicationCount: number;
    ScopeCount: number;
    IsLoading: boolean;
    TotalKeys: number;
    ActiveKeys: number;
    RevokedKeys: number;
    ExpiringSoonCount: number;
    ExpiredKeys: number;
    NeverUsedKeys: number;
    APIKeys: MJAPIKeyEntity[];
    RecentActivity: ActivityItem[];
    ScopeStats: ScopeStat[];
    TopUsedKeys: MJAPIKeyEntity[];
    ShowCreateDialog: boolean;
    ShowEditPanel: boolean;
    SelectedKeyId: string | null;
    /** Friendly Label of the selected key (NEVER the key value/hash/prefix). */
    SelectedKeyLabel: string | null;
    private readonly defaultUIConfig;
    private categoryUIConfigs;
    UserCanCreateKeys: boolean;
    UserCanRevokeKeys: boolean;
    constructor(cdr: ChangeDetectorRef);
    ngOnInit(): Promise<void>;
    /**
     * Publish the current API Keys dashboard state to the AI agent. Re-invoked on
     * every meaningful state change (data load, tab switch, selection). Only
     * counts, navigation state, and friendly display names are exposed — never
     * key secrets, hashes, or prefixes.
     */
    private publishAgentContext;
    /**
     * Register the read-only / navigational client tools the agent may invoke.
     * Every Handler is tolerant: validates input and returns
     * `{ Success: false, ErrorMessage }` rather than throwing.
     */
    private registerAgentClientTools;
    private static readonly API_KEYS_TABS;
    private static readonly API_KEYS_FILTERS;
    private handleSwitchTabTool;
    private handleFilterByStatusTool;
    private handleSearchTool;
    /**
     * Resolve an API key by its friendly Label (exact, case-insensitive, then
     * partial-contains) and open its details panel for VIEWING. Read-only: opens
     * the inspection panel; never reveals the key value/hash/prefix and never
     * edits, revokes, or rotates.
     */
    private handleSelectKeyTool;
    private handleRefreshTool;
    ngOnDestroy(): void;
    GetResourceDisplayName(_data: ResourceData): Promise<string>;
    GetResourceIconClass(_data: ResourceData): Promise<string>;
    /**
     * Load all dashboard data
     */
    loadData(): Promise<void>;
    /**
     * Load application and scope counts for tab badges.
     * Uses cached data from APIKeysEngineBase.
     */
    private loadCounts;
    /**
     * Load all API keys
     */
    private loadAPIKeys;
    /**
     * Load scope statistics by category.
     * Uses cached data from APIKeysEngineBase.
     */
    private loadScopeStats;
    /**
     * Load recent activity from usage logs and key changes
     */
    private loadRecentActivity;
    /**
     * Check user permissions
     */
    private checkPermissions;
    /**
     * Calculate dashboard statistics from loaded data
     */
    private calculateStatistics;
    /**
     * Refresh all data
     */
    refresh(): Promise<void>;
    /**
     * Switch to list view
     */
    showListView(filter?: APIKeyFilter): void;
    /**
     * Switch to overview
     */
    showOverview(): void;
    /**
     * Open create dialog
     */
    openCreateDialog(): void;
    /**
     * Handle key created
     */
    onKeyCreated(result: APIKeyCreateResult): Promise<void>;
    /**
     * Handle create dialog closed
     */
    onCreateDialogClosed(): void;
    /**
     * Open edit panel for a key
     */
    openEditPanel(key: MJAPIKeyEntity): void;
    /**
     * Handle key from list selected
     */
    onKeySelected(key: MJAPIKeyEntity): void;
    /**
     * Handle key updated
     */
    onKeyUpdated(): Promise<void>;
    /**
     * Handle key revoked
     */
    onKeyRevoked(): Promise<void>;
    /**
     * Handle edit panel closed
     */
    onEditPanelClosed(): void;
    /**
     * Get health score (0-100) based on key status
     */
    getHealthScore(): number;
    /**
     * Get health label based on score
     */
    getHealthLabel(): string;
    /**
     * Get CSS class for health banner
     */
    getHealthClass(): string;
    /**
     * Get donut chart offset for segment
     */
    getDonutOffset(index: number): number;
    /**
     * Get activity icon based on action
     */
    getActionIcon(action: ActivityAction): string;
    /**
     * Get CSS class for activity action
     */
    getActionClass(action: ActivityAction): string;
    /**
     * Format date for display
     */
    formatDate(date: Date | null): string;
    /**
     * Format expiration for display
     */
    formatExpiration(date: Date | null): string;
    /**
     * Get expiration status class
     */
    getExpirationClass(key: MJAPIKeyEntity): string;
    /**
     * View activity for a key
     */
    onActivityClick(activity: ActivityItem): void;
    /**
     * View scope details - now navigates to scopes tab
     */
    onScopeClick(_stat: ScopeStat): void;
    /**
     * Switch to a main tab. Resets to the overview view when returning to the
     * Keys tab so the user always lands on the dashboard, not a stale list view.
     */
    switchTab(tab: MainTab): void;
    /**
     * L2 tabs rendered as `<mj-tab-nav>` in the interior chrome's [toolbar] slot.
     * Badges reflect live counts; Usage Analytics has no badge by design.
     */
    get tabsConfig(): TabConfig[];
    /** Adapter for `<mj-tab-nav>`'s string-typed `(TabChange)` output. */
    onTabChange(key: string): void;
    /** Title rendered in the interior chrome — varies per tab. */
    get currentTabTitle(): string;
    /** Subtitle rendered in the interior chrome — varies per tab to give context. */
    get currentTabSubtitle(): string;
    /**
     * Handle updates from child panels
     */
    onDataUpdated(): Promise<void>;
    static ɵfac: i0.ɵɵFactoryDeclaration<APIKeysResourceComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<APIKeysResourceComponent, "mj-api-keys-resource", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=api-keys-resource.component.d.ts.map