/**
 * Model Profile Manager
 *
 * Manages multiple AI provider profiles with failover support.
 * Automatically switches to backup providers when failures occur.
 */
import { EventEmitter } from 'events';
import type { ModelProfile, ProfileSelection } from './types.js';
import { OAuthManager } from './manager.js';
/**
 * Profile manager configuration
 */
export interface ProfileManagerConfig {
    /** Maximum consecutive failures before circuit opens */
    circuitBreakerThreshold: number;
    /** Circuit breaker reset time (ms) */
    circuitBreakerResetMs: number;
    /** Half-open test interval (ms) */
    halfOpenIntervalMs: number;
    /** Failure decay time (ms) - failures older than this don't count */
    failureDecayMs: number;
}
/**
 * Default profile manager configuration
 */
export declare const DEFAULT_PROFILE_MANAGER_CONFIG: ProfileManagerConfig;
/**
 * Model Profile Manager
 *
 * Manages provider profiles and handles automatic failover.
 */
export declare class ModelProfileManager extends EventEmitter {
    private config;
    private profiles;
    private oauthManager;
    private halfOpenTimers;
    constructor(config?: Partial<ProfileManagerConfig>);
    /**
     * Set OAuth manager for OAuth-authenticated profiles
     */
    setOAuthManager(manager: OAuthManager): void;
    /**
     * Add or update a profile
     */
    addProfile(profile: Omit<ModelProfile, 'failureCount' | 'circuitState'>): void;
    /**
     * Get profile by ID
     */
    getProfile(id: string): ModelProfile | undefined;
    /**
     * Get all profiles
     */
    getAllProfiles(): ModelProfile[];
    /**
     * Get enabled profiles sorted by priority
     */
    getEnabledProfiles(): ModelProfile[];
    /**
     * Remove a profile
     */
    removeProfile(id: string): boolean;
    /**
     * Enable a profile
     */
    enableProfile(id: string): boolean;
    /**
     * Disable a profile
     */
    disableProfile(id: string): boolean;
    /**
     * Get the best available profile for a model
     */
    selectProfile(preferredModel?: string): ProfileSelection | null;
    /**
     * Get next available profile after a failure
     */
    getNextAvailableProfile(failedProfileId: string, preferredModel?: string): Promise<ProfileSelection | null>;
    /**
     * Record a failure for a profile
     */
    recordFailure(profileId: string, error?: Error): void;
    /**
     * Record a success for a profile
     */
    recordSuccess(profileId: string): void;
    /**
     * Open the circuit breaker for a profile
     */
    private openCircuit;
    /**
     * Schedule transition to half-open state
     */
    private scheduleHalfOpen;
    /**
     * Get access token for a profile
     */
    getAccessToken(profileId: string): Promise<string | null>;
    /**
     * Check if a profile is ready to use
     */
    isProfileReady(profile: ModelProfile): boolean;
    /**
     * Check if a profile supports a specific model
     */
    private profileSupportsModel;
    /**
     * Initialize default profiles
     */
    private initializeDefaultProfiles;
    /**
     * Get statistics
     */
    getStats(): {
        totalProfiles: number;
        enabledProfiles: number;
        openCircuits: number;
        halfOpenCircuits: number;
    };
    /**
     * Shutdown
     */
    shutdown(): void;
}
/**
 * Get model profile manager instance
 */
export declare function getModelProfileManager(config?: Partial<ProfileManagerConfig>): ModelProfileManager;
/**
 * Reset model profile manager instance
 */
export declare function resetModelProfileManager(): void;
export default ModelProfileManager;
