/**
 * Async Project Loader
 *
 * Advanced batch fetching with:
 * - Smart pagination (50-project batches)
 * - Real-time progress tracking
 * - Graceful cancelation (Ctrl+C)
 * - Retry logic with exponential backoff
 * - Rate limit handling
 * - Graceful degradation (reduce batch size on timeout)
 * - Continue-on-failure error handling
 * - Comprehensive error logging
 *
 * @module cli/helpers/async-project-loader
 */
import { Logger } from '../../utils/logger.js';
import type { JiraCredentials, AdoCredentials } from './project-count-fetcher.js';
/**
 * Project provider type
 */
export type ProjectProvider = 'jira' | 'ado';
/**
 * Project metadata
 */
export interface Project {
    id: string;
    key: string;
    name: string;
    projectTypeKey?: string;
    simplified?: boolean;
}
/**
 * Fetch options
 */
export interface FetchOptions {
    batchSize?: number;
    updateFrequency?: number;
    showEta?: boolean;
    stateFile?: string;
    errorLogFile?: string;
    logger?: Logger;
}
/**
 * Fetch result
 */
export interface FetchResult {
    projects: Project[];
    succeeded: number;
    failed: number;
    skipped: number;
    errors: FetchError[];
    canceled?: boolean;
}
/**
 * Fetch error with context
 */
export interface FetchError {
    projectKey: string;
    error: string;
    timestamp: string;
    suggestion: string;
    retryAttempts?: number;
}
/**
 * Async Project Loader
 *
 * Handles batch fetching from issue trackers with advanced features:
 * - Smart pagination (50-project batches for optimal performance)
 * - Real-time progress tracking with ETA
 * - Graceful cancelation with state persistence
 * - Retry logic with exponential backoff (1s, 2s, 4s)
 * - Rate limit detection and throttling
 * - Graceful degradation (reduce batch size on timeout)
 * - Continue-on-failure (single error doesn't block batch)
 * - Comprehensive error logging
 *
 * @example
 * ```typescript
 * const loader = new AsyncProjectLoader(credentials, 'jira', {
 *   batchSize: 50,
 *   showEta: true
 * });
 *
 * const result = await loader.fetchAllProjects(127);
 * console.log(`Imported ${result.succeeded}/${result.projects.length} projects`);
 * ```
 */
export declare class AsyncProjectLoader {
    private credentials;
    private provider;
    private options;
    private progressTracker?;
    private cancelHandler?;
    private currentBatchSize;
    constructor(credentials: JiraCredentials | AdoCredentials, provider: ProjectProvider, options?: FetchOptions);
    /**
     * Fetch all projects with smart pagination
     *
     * @param totalCount - Total number of projects to fetch
     * @returns Fetch result with projects and statistics
     */
    fetchAllProjects(totalCount: number): Promise<FetchResult>;
    /**
     * Fetch single batch with pagination
     *
     * @param offset - Starting offset
     * @param limit - Number of projects to fetch
     * @returns Array of projects
     */
    fetchBatch(offset: number, limit: number): Promise<Project[]>;
    /**
     * Fetch JIRA batch with pagination
     */
    private fetchJiraBatch;
    /**
     * Fetch Azure DevOps batch with pagination
     */
    private fetchAdoBatch;
    /**
     * Fetch batch with retry logic and exponential backoff
     */
    private fetchBatchWithRetry;
    /**
     * Check rate limit headers and throttle if needed
     */
    private checkRateLimit;
    /**
     * Save partial state on cancelation
     */
    private savePartialState;
    /**
     * Log error to file
     */
    private logError;
    /**
     * Get suggestion for error
     */
    private getSuggestion;
    /**
     * Check if error is auth-related (4XX)
     */
    private isAuthError;
    /**
     * Check if error is timeout-related
     */
    private isTimeoutError;
}
//# sourceMappingURL=async-project-loader.d.ts.map