/**
 * Base Plugin Source
 *
 * Abstract base class for all plugin sources with common functionality.
 * Integrates retry logic, enhanced caching, request building, and logging.
 *
 * @since v1.0.0
 * @updated v1.37.0 - Integrated source utilities
 */
import { type OperationLogger, createLogger } from '../../infrastructure/logger.js';
import { SourceError as BaseSourceError } from '../errors/index.js';
import type { IPluginSource, PluginInfo, SourceRequestOptions, SourceType } from '../types/index.js';
import { type SourceRequestBuilder } from './utils/request-builder.js';
import { type RetryOptions } from './utils/retry-decorator.js';
import { type CacheStats, SourceCache as EnhancedSourceCache } from './utils/source-cache.js';
/**
 * Source error with additional context
 * @deprecated Use SourceError from core/errors instead
 */
export declare class SourceError extends BaseSourceError {
    readonly source: string;
    readonly statusCode?: number | undefined;
    readonly name: string;
    constructor(message: string, source: string, statusCode?: number | undefined, retryable?: boolean);
}
/**
 * Simple in-memory cache for source responses
 * @deprecated Use EnhancedSourceCache from utils/source-cache instead
 */
export declare class SourceCache<T> {
    private cache;
    private defaultTtl;
    constructor(ttlSeconds?: number);
    get(key: string): T | null;
    set(key: string, data: T, ttlMs?: number): void;
    has(key: string): boolean;
    delete(key: string): boolean;
    clear(): void;
    get size(): number;
}
/**
 * Default request options
 */
export declare const DEFAULT_REQUEST_OPTIONS: Required<SourceRequestOptions>;
/**
 * Base source configuration options
 */
export interface BaseSourceOptions {
    /** Cache TTL in milliseconds (default: 5 minutes) */
    cacheTtl?: number;
    /** Maximum cache entries (default: 500) */
    maxCacheSize?: number;
    /** Request timeout in milliseconds (default: 30000) */
    timeout?: number;
    /** User agent string */
    userAgent?: string;
    /** Enable retry with exponential backoff (default: true) */
    enableRetry?: boolean;
    /** Retry options */
    retryOptions?: RetryOptions;
    /** Enable debug logging (default: false) */
    debug?: boolean;
}
/**
 * Abstract base class for plugin sources
 *
 * Provides common functionality:
 * - TTL-based caching with statistics
 * - Retry logic with exponential backoff
 * - Structured logging with operation tracking
 * - Request building with auth support
 */
export declare abstract class BasePluginSource implements IPluginSource {
    abstract readonly id: string;
    abstract readonly name: string;
    abstract readonly type: SourceType;
    enabled: boolean;
    priority: number;
    /** @deprecated Use enhancedCache instead */
    protected cache: SourceCache<PluginInfo>;
    /** Enhanced cache with statistics and pattern invalidation */
    protected enhancedCache: EnhancedSourceCache<PluginInfo>;
    /** Request builder for making HTTP requests */
    protected requestBuilder: SourceRequestBuilder;
    /** Logger instance for this source */
    protected log: ReturnType<typeof createLogger>;
    protected lastError: string | null;
    private readonly enableRetry;
    private readonly retryOptions;
    constructor(options?: BaseSourceOptions);
    /**
     * Initialize the source (called after construction)
     * Override in subclasses to set source-specific configuration
     */
    protected initialize(): void;
    /**
     * Get plugin information by identifier
     */
    abstract getPluginInfo(identifier: string): Promise<PluginInfo | null>;
    /**
     * Search for plugins
     */
    abstract searchPlugins(query: string, limit?: number): Promise<PluginInfo[]>;
    /**
     * Get latest version for a plugin
     */
    abstract getLatestVersion(identifier: string): Promise<string | null>;
    /**
     * Check if source supports a Minecraft version
     */
    supportsMinecraftVersion(_mcVersion: string): Promise<boolean>;
    /**
     * Get the last error message
     */
    getLastError(): string | null;
    /**
     * Clear the cache
     */
    clearCache(): void;
    /**
     * Get cache statistics
     */
    getCacheStats(): CacheStats;
    /**
     * Invalidate cache entries matching a pattern
     */
    invalidateCache(pattern?: RegExp | string): number;
    /**
     * Start a logging operation for tracking
     */
    protected startOperation(name: string, _context?: Record<string, unknown>): OperationLogger;
    /**
     * Build headers for requests
     */
    protected buildHeaders(additional?: Record<string, string>): Record<string, string>;
    /**
     * Make a fetch request with error handling
     */
    protected fetchJson<T>(url: string, options?: RequestInit): Promise<T>;
    /**
     * Make a fetch request with automatic retry on retryable errors
     */
    protected fetchJsonWithRetry<T>(url: string, options?: RequestInit): Promise<T>;
    /**
     * Get from cache or fetch
     */
    protected cachedFetch<T>(key: string, fetcher: () => Promise<T>, useCache?: boolean): Promise<T>;
    /**
     * Get from enhanced cache or fetch with automatic caching
     * Uses the new EnhancedSourceCache with statistics tracking
     */
    protected cachedFetchEnhanced<T>(key: string, fetcher: () => Promise<T>, options?: {
        useCache?: boolean;
        ttlMs?: number;
    }): Promise<T>;
    /**
     * Get from cache or fetch with retry support
     * Combines caching with automatic retry on retryable errors
     */
    protected cachedFetchWithRetry<T>(key: string, fetcher: () => Promise<T>, options?: {
        useCache?: boolean;
        ttlMs?: number;
    }): Promise<T>;
}
//# sourceMappingURL=base.d.ts.map