/**
 * @fileoverview Prompt Run Analysis — Charts-first analytics with a detail table.
 *
 * Displays stats summary, runs-over-time chart, model/prompt/status breakdowns,
 * and a sortable, paginated detail table. All data is loaded via RunView from
 * the "MJ: AI Prompt Runs" entity.
 */
import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
import { GlobalFilterState } from '../../../interfaces/analytics-preferences.interface';
import * as i0 from "@angular/core";
interface PromptRunRecord {
    ID: string;
    RunAt: string;
    CompletedAt: string | null;
    Status: string;
    Success: boolean;
    Cost: number | null;
    TotalCost: number | null;
    TokensUsed: number | null;
    TokensPrompt: number | null;
    TokensCompletion: number | null;
    TokensCacheRead: number | null;
    TokensCacheWrite: number | null;
    ExecutionTimeMS: number | null;
    ModelID: string | null;
    Model: string | null;
    AgentID: string | null;
    Agent: string | null;
    PromptID: string | null;
    Prompt: string | null;
    ErrorMessage: string | null;
}
interface PromptRunStats {
    TotalRuns: number;
    AvgCost: number;
    AvgTokens: number;
    AvgLatencySeconds: number;
    SuccessRate: number;
    P95LatencySeconds: number;
    TotalCost: number;
    CacheHitRate: number;
}
interface ChartBucket {
    label: string;
    value: number;
    heightPercent: number;
    startTime: Date;
    endTime: Date;
}
interface BreakdownItem {
    name: string;
    id: string;
    count: number;
    percentage: number;
}
interface StatusBreakdownItem extends BreakdownItem {
    cssClass: string;
}
type ChartMetric = 'volume' | 'cost' | 'tokens' | 'cacheHit';
type SortField = 'RunAt' | 'Prompt' | 'Model' | 'Status' | 'ExecutionTimeMS' | 'TokensUsed' | 'Cost';
type SortDirection = 'asc' | 'desc';
export declare class AnalyticsPromptRunsComponent extends BaseAngularComponent implements OnInit, OnDestroy {
    private cdr;
    private destroy$;
    private isInitialized;
    private _timeRange;
    set TimeRange(value: string);
    get TimeRange(): string;
    private _filters;
    set Filters(value: GlobalFilterState);
    get Filters(): GlobalFilterState;
    TimeRangeChange: EventEmitter<string>;
    FiltersChange: EventEmitter<GlobalFilterState>;
    IsLoading: boolean;
    ActiveChartMetric: ChartMetric;
    SortField: SortField;
    SortDirection: SortDirection;
    CurrentPage: number;
    private allRuns;
    readonly ChartMetricOptions: {
        key: ChartMetric;
        label: string;
    }[];
    readonly TableColumns: {
        field: SortField;
        label: string;
        sortable: boolean;
    }[];
    ngOnInit(): Promise<void>;
    ngOnDestroy(): void;
    get FilteredRuns(): PromptRunRecord[];
    get Stats(): PromptRunStats;
    get ChartBuckets(): ChartBucket[];
    get ModelBreakdown(): BreakdownItem[];
    get PromptBreakdown(): BreakdownItem[];
    get StatusBreakdown(): StatusBreakdownItem[];
    get PagedRuns(): PromptRunRecord[];
    get TotalPages(): number;
    OnTimeRangeChange(range: string): void;
    OnFiltersChange(filters: GlobalFilterState): void;
    OnChartMetricChange(metric: ChartMetric): void;
    OnChartBucketClick(_bucket: ChartBucket): void;
    OnSortChange(field: SortField): void;
    OnPageChange(page: number): void;
    ApplyModelFilter(modelId: string): void;
    ApplyPromptFilter(promptId: string): void;
    ApplyStatusFilter(status: string): void;
    ExportCSV(): void;
    FormatCurrency(value: number | null, decimals: number): string;
    FormatTimestamp(dateStr: string): string;
    FormatDuration(ms: number | null): string;
    FormatChartValue(value: number): string;
    GetStatusClass(status: string): string;
    LoadData(): Promise<void>;
    private applyFilters;
    /**
     * Total tokens the model processed for a run, INCLUDING cached input. TokensUsed excludes the
     * cache buckets by design, so a heavily-cached run looks tiny; this is the true throughput.
     */
    TrueTotalTokens(run: PromptRunRecord): number;
    private computeStats;
    private computeChartBuckets;
    private getChartMetricValue;
    private computeBreakdown;
    private computeStatusBreakdown;
    private sortRuns;
    private getTimeRangeCutoff;
    private getBucketCount;
    private formatBucketLabel;
    private sumNullable;
    private collectNonNull;
    private percentile;
    private resetPagination;
    static ɵfac: i0.ɵɵFactoryDeclaration<AnalyticsPromptRunsComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AnalyticsPromptRunsComponent, "app-analytics-prompt-runs", never, { "TimeRange": { "alias": "TimeRange"; "required": false; }; "Filters": { "alias": "Filters"; "required": false; }; }, { "TimeRangeChange": "TimeRangeChange"; "FiltersChange": "FiltersChange"; }, never, never, false, never>;
}
export declare function LoadAnalyticsPromptRuns(): void;
export {};
//# sourceMappingURL=prompt-run-analysis.component.d.ts.map