/**
 * Registry Offline Handler
 *
 * Implements cache-first strategy with graceful fallback for offline scenarios.
 * Wraps RegistryClient and CacheManager to provide unified online/offline access.
 *
 * @module registry/offline/offline-handler
 * @version 2.0.0
 */
import type { RegistryResponse, RegistryFactoryMetadata, SearchResponse, CapabilitiesResponse, ValidationIssue } from '../types/index.js';
/**
 * Offline handler configuration
 */
export interface OfflineHandlerConfig {
    /** Registry client configuration */
    registryClient?: {
        endpoint?: string;
        timeout?: number;
        retries?: number;
    };
    /** Cache manager configuration */
    cache?: {
        cacheDir?: string;
        ttl?: number;
        enabled?: boolean;
    };
    /** Offline mode - only use cache, never network */
    offlineMode?: boolean;
    /** Allow stale cache as fallback (default: true) */
    allowStaleCache?: boolean;
}
/**
 * Fetch result with metadata
 */
export interface FetchResult {
    /** Registry response data */
    data: RegistryResponse;
    /** Data source */
    source: 'network' | 'cache-fresh' | 'cache-stale';
    /** Validation issues (warnings about cache staleness, etc.) */
    issues: ValidationIssue[];
}
/**
 * Registry Offline Handler
 *
 * Provides unified access to registry metadata with offline-first strategy:
 * 1. Try to fetch from network
 * 2. If network fails, use fresh cache
 * 3. If no fresh cache, use stale cache as fallback (with warning)
 * 4. If no cache at all, throw error
 */
export declare class OfflineHandler {
    private client;
    private cache;
    private config;
    constructor(config?: OfflineHandlerConfig);
    /**
     * Fetch all factories with offline-first strategy
     *
     * @returns Fetch result with data, source, and issues
     */
    fetchFactories(): Promise<FetchResult>;
    /**
     * Get specific factory by name
     *
     * @param name - Factory name
     * @returns Factory metadata or null if not found
     */
    getFactory(name: string): Promise<RegistryFactoryMetadata | null>;
    /**
     * Search factories
     *
     * Note: Search functionality requires network access.
     * Falls back to local filtering of cached data when offline.
     *
     * @param query - Search query
     * @returns Search results
     */
    search(query: string): Promise<SearchResponse>;
    /**
     * Get all capabilities
     *
     * @returns Capabilities response
     */
    getCapabilities(): Promise<CapabilitiesResponse>;
    /**
     * Check if registry is accessible
     *
     * @returns True if network access is available
     */
    checkHealth(): Promise<boolean>;
    /**
     * Clear cache
     */
    clearCache(): Promise<void>;
    /**
     * Get cache status
     *
     * @returns Cache status information
     */
    getCacheStatus(): Promise<{
        exists: boolean;
        valid: boolean;
        age?: number;
        timeToExpiration?: number;
        createdAt?: string;
        expiresAt?: string;
    }>;
    /**
     * Get registry client endpoint
     *
     * @returns Registry endpoint URL
     */
    getEndpoint(): string;
    /**
     * Get cache file path
     *
     * @returns Absolute path to cache file
     */
    getCacheFile(): string;
    /**
     * Enable offline mode
     */
    enableOfflineMode(): void;
    /**
     * Disable offline mode
     */
    disableOfflineMode(): void;
    /**
     * Check if offline mode is enabled
     *
     * @returns True if offline mode is enabled
     */
    isOfflineMode(): boolean;
}
/**
 * Offline error
 *
 * Thrown when registry data is unavailable both from network and cache.
 */
export declare class OfflineError extends Error {
    code: string;
    issues: ValidationIssue[];
    constructor(message: string, code: string, issues: ValidationIssue[]);
    /**
     * Get user-friendly error message
     */
    getUserMessage(): string;
}
//# sourceMappingURL=offline-handler.d.ts.map