import { OnDestroy, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import { Subject } from 'rxjs';
import { CompositeKey } from '@memberjunction/core';
import { ResourceData } from '@memberjunction/core-entities';
import { AITestHarnessDialogService } from '@memberjunction/ng-ai-test-harness';
import { CreateAgentService } from '@memberjunction/ng-agents';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { MJAIAgentEntityExtended } from '@memberjunction/ai-core-plus';
import { TreeBranchConfig, TreeLeafConfig, AfterNodeClickEventArgs, AfterNodeDoubleClickEventArgs } from '@memberjunction/ng-trees';
import { FilterFieldConfig } from '@memberjunction/ng-ui-components';
import * as i0 from "@angular/core";
interface AgentFilter {
    searchTerm: string;
    agentType: string;
    parentAgent: string;
    status: string;
    executionMode: string;
    exposeAsAction: string;
    categoryId: string;
}
/**
 * AI Agents Resource - displays AI agent configuration and management
 * Extends BaseResourceComponent to work with the resource type system
 */
export declare class AgentConfigurationComponent extends BaseResourceComponent implements AfterViewInit, OnDestroy {
    private testHarnessService;
    private createAgentService;
    private cdr;
    private readonly USER_SETTINGS_KEY;
    private settingsPersistSubject;
    protected destroy$: Subject<void>;
    private settingsLoaded;
    isLoading: boolean;
    filterPanelVisible: boolean;
    viewMode: 'grid' | 'list' | 'tree';
    expandedAgentId: string | null;
    agents: MJAIAgentEntityExtended[];
    filteredAgents: MJAIAgentEntityExtended[];
    selectedAgent: MJAIAgentEntityExtended | null;
    detailPanelVisible: boolean;
    sortColumn: string;
    sortDirection: 'asc' | 'desc';
    currentFilters: AgentFilter;
    /** Static option arrays for the shared mj-filter-panel. */
    readonly statusOptions: {
        text: string;
        value: string;
    }[];
    readonly executionModeOptions: {
        text: string;
        value: string;
    }[];
    readonly exposeAsActionOptions: {
        text: string;
        value: string;
    }[];
    /** Dynamic agent-type options built from AIEngineBase metadata. */
    get agentTypeOptions(): {
        text: string;
        value: string;
    }[];
    /** Dynamic parent-agent options built from the loaded agents (top-level only). */
    get parentAgentOptions(): {
        text: string;
        value: string;
    }[];
    /** View-mode options for the shared <mj-view-toggle>. */
    readonly agentViewOptions: {
        key: string;
        icon: string;
        title: string;
    }[];
    /** Field config consumed by the centralized <mj-filter-panel>. */
    get agentFilterFields(): FilterFieldConfig[];
    /** Current category selection for the tree dropdown (Category is projected into mj-filter-panel as a custom widget). */
    SelectedCategoryKey: CompositeKey | null;
    /**
     * Timestamp of last real (non-null) category set. Used to swallow spurious
     * null re-emits from <mj-tree-dropdown> that arrive milliseconds after a
     * real selection — without the guard, the spurious null resets categoryId
     * to 'all' before the user sees the filtered list, making the Category
     * filter appear broken. See onCategoryChange below.
     */
    private _lastCategorySetAt;
    /** Handler for the projected mj-tree-dropdown — extracts the entity ID from the CompositeKey. */
    onCategoryChange(value: CompositeKey | CompositeKey[] | null): void;
    /** Receive the updated values record from <mj-filter-panel> and apply it. */
    onFilterValuesChange(values: Record<string, unknown>): void;
    /** Number of currently-applied filter criteria inside the popover (excludes searchTerm — surfaced separately in the header). */
    get ActiveFilterCount(): number;
    selectedAgentForTest: MJAIAgentEntityExtended | null;
    CategoryBranchConfig: TreeBranchConfig;
    AgentLeafConfig: TreeLeafConfig;
    /** Cache for permission checks to avoid repeated calculations */
    private _permissionCache;
    private _metadata;
    /** Check if user can create AI Agents */
    get UserCanCreateAgents(): boolean;
    /** Check if user can read AI Agents */
    get UserCanReadAgents(): boolean;
    /** Check if user can update AI Agents */
    get UserCanUpdateAgents(): boolean;
    /** Check if user can delete AI Agents */
    get UserCanDeleteAgents(): boolean;
    /**
     * Helper method to check entity permissions with caching
     * @param entityName - The name of the entity to check permissions for
     * @param permissionType - The type of permission to check (Create, Read, Update, Delete)
     * @returns boolean indicating if user has the permission
     */
    private checkEntityPermission;
    /**
     * Clears the permission cache. Call this when user context changes or permissions are updated.
     */
    clearPermissionCache(): void;
    constructor(testHarnessService: AITestHarnessDialogService, createAgentService: CreateAgentService, cdr: ChangeDetectorRef);
    ngAfterViewInit(): Promise<void>;
    ngOnDestroy(): void;
    /**
     * Load saved user preferences from the UserInfoEngine
     */
    private loadUserPreferences;
    /**
     * Apply loaded preferences to component state
     */
    private applyUserPreferences;
    /**
     * Get current preferences as an object for saving
     */
    private getCurrentPreferences;
    /**
     * Persist user preferences to storage (debounced)
     */
    private saveUserPreferencesDebounced;
    /**
     * Actually persist user preferences to the UserInfoEngine
     */
    private persistUserPreferences;
    private applyInitialState;
    private loadAgents;
    toggleFilterPanel(): void;
    onMainSplitterChange(_event: any): void;
    onFiltersChange(filters: AgentFilter): void;
    onFilterChange(): void;
    /** Handler for the inline mj-page-search input in the page-header toolbar. */
    onSearchTermChange(value: string): void;
    onResetFilters(): void;
    private applyFilters;
    /**
     * Sort the agents by the specified column
     */
    sortBy(column: string): void;
    /**
     * Apply sorting to the filtered list
     */
    private applySorting;
    private emitStateChange;
    setViewMode(mode: 'grid' | 'list' | 'tree'): void;
    toggleAgentExpansion(agentId: string): void;
    /**
     * Show the detail panel for an agent
     */
    showAgentDetails(agent: MJAIAgentEntityExtended, event?: Event): void;
    /**
     * Close the detail panel
     */
    closeDetailPanel(): void;
    /**
     * Open the full entity record from the detail panel
     */
    openAgentFromPanel(): void;
    /**
     * Get the parent agent name if it exists
     */
    getParentAgentName(agent: MJAIAgentEntityExtended): string | null;
    /**
     * Get agent type name
     */
    getAgentTypeName(agent: MJAIAgentEntityExtended): string;
    openAgentRecord(agentId: string): void;
    /**
     * Opens the create agent slide-in panel. Upon successful creation,
     * saves the agent and navigates to the new record.
     */
    createNewAgent(): void;
    /**
     * Handles the result from the create agent slide-in.
     * Saves the agent and navigates to the new record.
     */
    private handleAgentCreated;
    runAgent(agent: MJAIAgentEntityExtended): void;
    closeTestHarness(): void;
    getAgentIconColor(agent: MJAIAgentEntityExtended): string;
    onOpenRecord(entityName: string, recordId: string): void;
    getExecutionModeColor(mode: string): string;
    getExecutionModeIcon(mode: string): string;
    /**
     * Gets the agent's display icon
     * Prioritizes LogoURL, falls back to IconClass, then default robot icon
     */
    getAgentIcon(agent: MJAIAgentEntityExtended): string;
    /**
     * Checks if the agent has a logo URL (for image display)
     */
    hasLogoURL(agent: MJAIAgentEntityExtended): boolean;
    /** Lightweight category row for descendant filtering */
    private categories;
    /** Load categories for descendant-based filter matching */
    private loadCategories;
    /** Get a category and all its descendant IDs (for inclusive filtering) */
    private getCategoryAndDescendantIds;
    /** Handle click on a tree node — open detail panel for agents */
    onTreeNodeClick(event: AfterNodeClickEventArgs): void;
    /** Handle double-click on a tree node — open full record for agents */
    onTreeNodeDoubleClick(event: AfterNodeDoubleClickEventArgs): void;
    /**
     * Get the display name for this resource
     */
    GetResourceDisplayName(data: ResourceData): Promise<string>;
    /**
     * Get the icon class for this resource
     */
    GetResourceIconClass(data: ResourceData): Promise<string>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AgentConfigurationComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AgentConfigurationComponent, "app-agent-configuration", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=agent-configuration.component.d.ts.map