import { OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { MJActionExecutionLogEntity, MJActionEntity, ResourceData } from '@memberjunction/core-entities';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { FilterFieldConfig } from '@memberjunction/ng-ui-components';
import { Subject, BehaviorSubject } from 'rxjs';
import * as i0 from "@angular/core";
interface ExecutionMetrics {
    totalExecutions: number;
    successfulExecutions: number;
    failedExecutions: number;
    averageDuration: number;
    executionsToday: number;
    executionsThisWeek: number;
    currentlyRunning: number;
}
interface ExecutionTrend {
    date: string;
    successful: number;
    failed: number;
    total: number;
}
/**
 * Execution Monitoring Resource - displays action execution logs and metrics
 */
export declare class ActionExecutionMonitoringComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    private cdr;
    isLoading: boolean;
    executions: MJActionExecutionLogEntity[];
    filteredExecutions: MJActionExecutionLogEntity[];
    actions: Map<string, MJActionEntity>;
    metrics: ExecutionMetrics;
    executionTrends: ExecutionTrend[];
    searchTerm$: BehaviorSubject<string>;
    selectedResult$: BehaviorSubject<string>;
    selectedTimeRange$: BehaviorSubject<string>;
    selectedAction$: BehaviorSubject<string>;
    timeRangeOptions: {
        text: string;
        value: string;
    }[];
    resultOptions: {
        text: string;
        value: string;
    }[];
    actionOptions: Array<{
        text: string;
        value: string;
    }>;
    /** Allowed result-filter values (mirrors `resultOptions`). */
    private readonly resultFilterValues;
    /** Allowed time-range values (mirrors `timeRangeOptions`). */
    private readonly timeRangeValues;
    /** The currently selected execution (set when the agent/user opens one) — surfaced in context + drives the tool mode. */
    private selectedExecution;
    /**
     * Tracks which mode's tool set is currently registered so {@link syncAgentToolsForMode}
     * only calls into NavigationService on the list↔detail transition, not on every filter change.
     */
    private lastRegisteredToolMode;
    protected destroy$: Subject<void>;
    constructor(cdr: ChangeDetectorRef);
    ngOnInit(): void;
    ngOnDestroy(): void;
    private setupFilters;
    /** Publish the current monitor state to the agent. Called on load and on every filter change.
     *  Deep context: execution metrics, success rate, all filter state, the selected execution
     *  (id + action NAME + result), and the bounded list of filtered action names in view. */
    private publishAgentContext;
    /** Distinct action names among the currently-filtered executions (for context). */
    private distinctVisibleActionNames;
    /** The current tool mode: 'detail' when an execution is selected, else 'list'. */
    private currentToolMode;
    /**
     * Re-scope the agent's client tools to the CURRENT mode (list vs. selected-execution
     * detail). Guarded on {@link lastRegisteredToolMode} so it only calls NavigationService on
     * the mode flip — `publishAgentContext` fires on every filter change but the tool set only
     * changes when an execution is selected/deselected.
     */
    private syncAgentToolsForMode;
    /** COMMON tools — available in BOTH modes (search, filter, sort, refresh, select-by-id/name). */
    private buildCommonTools;
    /** LIST-mode tools — only when NO execution is selected: select an execution (which flips to detail mode). */
    private buildListTools;
    /** DETAIL-mode tools — only when an execution IS selected: open it, jump to its action, clear the selection. */
    private buildDetailTools;
    /** Select an execution (sets selection, re-scopes tools to detail mode, re-publishes context). */
    private selectExecution;
    /** Clear the execution selection (re-scopes tools back to list mode). */
    private clearExecutionSelection;
    private loadData;
    private populateActionsMap;
    private buildActionOptions;
    private calculateMetrics;
    private calculateAverageDuration;
    private generateExecutionTrends;
    private applyFilters;
    private getTimeRangeCutoff;
    onSearchChange(searchTerm: string): void;
    onResultFilterChange(result: string): void;
    onTimeRangeChange(timeRange: string): void;
    onActionFilterChange(actionId: string): void;
    get FilterFields(): FilterFieldConfig[];
    get FilterValues(): Record<string, unknown>;
    get ActiveFilterCount(): number;
    onFilterValuesChange(v: Record<string, unknown>): void;
    resetFilters(): void;
    openExecution(execution: MJActionExecutionLogEntity): void;
    openAction(actionId: string): void;
    getActionName(actionId: string): string;
    getResultColor(resultCode: string | null): 'success' | 'warning' | 'error' | 'info';
    getResultIcon(resultCode: string | null): string;
    getDuration(execution: MJActionExecutionLogEntity): string;
    getSuccessRate(): number;
    refreshData(): void;
    onTotalExecutionsClick(): void;
    onSuccessRateClick(): void;
    onFailedExecutionsClick(): void;
    onRunningExecutionsClick(): void;
    GetResourceDisplayName(data: ResourceData): Promise<string>;
    GetResourceIconClass(data: ResourceData): Promise<string>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ActionExecutionMonitoringComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ActionExecutionMonitoringComponent, "mj-execution-monitoring", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=execution-monitoring.component.d.ts.map