import { EventEmitter } from 'events';
/**
 * Audit Log Entry Interface
 */
export interface AuditLogEntry {
    id?: string;
    timestamp: string;
    entity_type: 'task' | 'workflow' | 'webhook' | 'user' | 'system';
    entity_id: string;
    action: string;
    actor_id?: string;
    actor_type: 'user' | 'system' | 'api' | 'automation';
    details?: Record<string, any>;
    changes?: {
        field: string;
        old_value: any;
        new_value: any;
    }[];
    metadata?: {
        ip_address?: string;
        user_agent?: string;
        session_id?: string;
        api_key_id?: string;
        request_id?: string;
    };
    severity: 'info' | 'warning' | 'error' | 'critical';
    tags?: string[];
}
/**
 * Audit Query Options
 */
export interface AuditQueryOptions {
    entityType?: string;
    entityId?: string;
    actorId?: string;
    action?: string;
    severity?: string;
    startDate?: Date;
    endDate?: Date;
    tags?: string[];
    limit?: number;
    offset?: number;
    sort?: string;
}
/**
 * Audit Statistics
 */
export interface AuditStatistics {
    totalLogs: number;
    byEntityType: Record<string, number>;
    byAction: Record<string, number>;
    bySeverity: Record<string, number>;
    byActor: Record<string, number>;
    timeRange: {
        start: string;
        end: string;
    };
}
/**
 * Audit Logger Service
 * Comprehensive audit logging for all system activities
 */
export declare class AuditLogger extends EventEmitter {
    private client;
    private buffer;
    private bufferSize;
    private flushInterval;
    private flushIntervalMs;
    private enabled;
    constructor();
    private initializeClient;
    /**
     * Start buffer flush interval
     */
    private startBufferFlush;
    /**
     * Stop buffer flush interval
     */
    private stopBufferFlush;
    /**
     * Log an audit entry
     */
    log(entry: Omit<AuditLogEntry, 'timestamp'>): Promise<void>;
    /**
     * Log task action
     */
    logTaskAction(taskId: string, action: string, actorId?: string, details?: Record<string, any>, changes?: any[]): Promise<void>;
    /**
     * Log workflow transition
     */
    logWorkflowTransition(taskId: string, fromStatus: string, toStatus: string, triggeredBy: string, metadata?: Record<string, any>): Promise<void>;
    /**
     * Log webhook activity
     */
    logWebhookActivity(webhookId: string, action: string, success: boolean, details?: Record<string, any>): Promise<void>;
    /**
     * Log error
     */
    logError(entityType: AuditLogEntry['entity_type'], entityId: string, error: Error, context?: Record<string, any>): Promise<void>;
    /**
     * Log security event
     */
    logSecurityEvent(action: string, actorId: string, success: boolean, details?: Record<string, any>): Promise<void>;
    /**
     * Flush buffer to database
     */
    flush(): Promise<void>;
    /**
     * Query audit logs
     */
    query(options?: AuditQueryOptions): Promise<AuditLogEntry[]>;
    /**
     * Get audit statistics
     */
    getStatistics(startDate?: Date, endDate?: Date): Promise<AuditStatistics>;
    /**
     * Get audit timeline
     */
    getTimeline(entityId: string, entityType?: string): Promise<AuditLogEntry[]>;
    /**
     * Archive old audit logs
     */
    archiveOldLogs(daysToKeep?: number): Promise<number>;
    /**
     * Export audit logs
     */
    exportLogs(options: AuditQueryOptions, format?: 'json' | 'csv'): Promise<string>;
    /**
     * Enable or disable audit logging
     */
    setEnabled(enabled: boolean): void;
    /**
     * Clean up service
     */
    cleanup(): Promise<void>;
}
export declare const auditLogger: AuditLogger;
//# sourceMappingURL=auditLogger.d.ts.map