import { OnDestroy, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import { ResourceData } from '@memberjunction/core-entities';
import { AITestHarnessDialogService } from '@memberjunction/ng-ai-test-harness';
import { CreateAgentService } from '@memberjunction/ng-agents';
import { BaseResourceComponent, NavigationService } from '@memberjunction/ng-shared';
import { MJAIAgentEntityExtended } from '@memberjunction/ai-core-plus';
import * as i0 from "@angular/core";
interface AgentFilter {
    searchTerm: string;
    agentType: string;
    parentAgent: string;
    status: string;
    executionMode: string;
    exposeAsAction: string;
    categoryId: string;
}
/** Lightweight category row for tree-view grouping */
interface CategoryInfo {
    ID: string;
    Name: string;
    ParentID: string | null;
    Description: string | null;
}
/** A category node with nested agents and child categories for tree rendering */
export interface CategoryTreeNode {
    Category: CategoryInfo;
    Agents: MJAIAgentEntityExtended[];
    Children: CategoryTreeNode[];
    Expanded: boolean;
}
/**
 * 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 navigationService;
    private cdr;
    private readonly USER_SETTINGS_KEY;
    private settingsPersistSubject;
    private destroy$;
    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;
    selectedAgentForTest: MJAIAgentEntityExtended | null;
    categoryTree: CategoryTreeNode[];
    uncategorizedAgents: MJAIAgentEntityExtended[];
    private categories;
    /** 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, navigationService: NavigationService, 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;
    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;
    /** Load categories from the database and build the tree structure */
    private loadCategoriesAndBuildTree;
    /** Build tree nodes from flat categories + filtered agents */
    private buildCategoryTree;
    /** Recursively build a CategoryTreeNode */
    private buildTreeNode;
    /** Get a category and all its descendant IDs (for inclusive filtering) */
    private getCategoryAndDescendantIds;
    /** Toggle a category node's expanded state in the tree view */
    toggleCategoryNode(node: CategoryTreeNode): void;
    /** Check if a tree node has any visible content (agents or children with content) */
    hasVisibleContent(node: CategoryTreeNode): boolean;
    /** Get the total agent count for a category including all descendants */
    getAgentCount(node: CategoryTreeNode): number;
    /**
     * 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