/**
 * Analytics Repository
 *
 * Repository for analytics, tool statistics, and repair learning.
 */
import type Database from 'better-sqlite3';
import type { Analytics, ToolStats, RepairLearning } from '../schema.js';
export interface AnalyticsFilter {
    startDate?: string;
    endDate?: string;
    projectId?: string;
    model?: string;
}
export interface RepairLearningFilter {
    errorType?: RepairLearning['error_type'];
    language?: string;
    framework?: string;
    minSuccessRate?: number;
}
export declare class AnalyticsRepository {
    private db;
    constructor(db?: Database.Database);
    /**
     * Record daily analytics
     */
    recordAnalytics(data: Omit<Analytics, 'id'>): void;
    /**
     * Get analytics by filter
     */
    getAnalytics(filter?: AnalyticsFilter): Analytics[];
    /**
     * Get daily summary
     */
    getDailySummary(days?: number): {
        date: string;
        totalCost: number;
        totalRequests: number;
        totalTokens: number;
        avgResponseTime: number;
    }[];
    /**
     * Get total cost for period
     */
    getTotalCost(filter?: AnalyticsFilter): number;
    /**
     * Record tool usage
     */
    recordToolUsage(toolName: string, success: boolean, timeMs: number, cacheHit: boolean, projectId?: string): void;
    /**
     * Get tool statistics
     */
    getToolStats(projectId?: string): ToolStats[];
    /**
     * Get top tools by usage
     */
    getTopTools(limit?: number): {
        tool_name: string;
        usage: number;
        success_rate: number;
        avg_time_ms: number;
    }[];
    /**
     * Record repair attempt
     */
    recordRepairAttempt(errorPattern: string, errorType: RepairLearning['error_type'], strategy: string, success: boolean, attempts: number, options?: {
        contextHash?: string;
        language?: string;
        framework?: string;
        example?: string;
    }): void;
    /**
     * Get best repair strategies for error pattern
     */
    getBestStrategies(errorPattern: string, filter?: RepairLearningFilter, limit?: number): RepairLearning[];
    /**
     * Get repair learning statistics
     */
    getRepairStats(): {
        totalPatterns: number;
        avgSuccessRate: number;
        byErrorType: Record<string, {
            count: number;
            avgSuccessRate: number;
        }>;
    };
    /**
     * Delete old analytics data
     */
    deleteOldAnalytics(daysToKeep?: number): number;
    /**
     * Reset all statistics
     */
    resetStats(): void;
}
export declare function getAnalyticsRepository(): AnalyticsRepository;
export declare function resetAnalyticsRepository(): void;
