import type { RuntimeAwakeMetadata } from '../../../lib/runtime-web/runtime-awake';
import type { CachedMetadata } from './metadata-resolver.types';
import { CacheCorruptionError } from './metadata-resolver.types';
/**
 * Current cache version for compatibility checking.
 * Increment when cache schema changes.
 */
export declare const CACHE_VERSION = "1.0";
/**
 * Default cache file name.
 */
export declare const DEFAULT_CACHE_FILE_NAME = "runtime-awake-metadata.json";
/**
 * Default cache directory relative to project root.
 */
export declare const DEFAULT_CACHE_DIR = ".runtime";
/**
 * Default cache TTL in milliseconds (24 hours).
 */
export declare const DEFAULT_CACHE_TTL_MS: number;
/**
 * Configuration for CacheManager.
 *
 * @see Requirements 2.1
 */
export interface CacheConfig {
    /** Project root directory */
    readonly projectRoot: string;
    /** Cache file name (default: runtime-awake-metadata.json) */
    readonly cacheFileName?: string;
    /** Cache directory relative to project root (default: .runtime) */
    readonly cacheDir?: string;
    /** Cache TTL in milliseconds (default: 24 hours) */
    readonly cacheTtlMs?: number;
}
/**
 * Result of reading cache.
 */
export interface CacheReadResult {
    /** Whether cache was found and valid */
    readonly found: boolean;
    /** Cached metadata (if found and valid) */
    readonly data?: CachedMetadata;
    /** Whether cache is fresh (within TTL) */
    readonly fresh?: boolean;
    /** Error if cache was corrupted */
    readonly error?: CacheCorruptionError;
}
/**
 * Interface for cache management operations.
 *
 * @see Requirements 2.1, 2.2, 2.4, 2.5
 */
export interface ICacheManager {
    /**
     * Read cached metadata if valid.
     *
     * @returns Cache read result
     */
    read(): Promise<CacheReadResult>;
    /**
     * Write metadata to cache.
     *
     * @param metadata - Metadata to cache
     * @param stackName - Stack name used to load metadata
     */
    write(metadata: RuntimeAwakeMetadata, stackName: string): Promise<void>;
    /**
     * Check if cache is fresh (within TTL).
     *
     * @returns True if cache exists and is fresh
     */
    isFresh(): Promise<boolean>;
    /**
     * Clear the cache.
     */
    clear(): Promise<void>;
    /**
     * Get the cache file path.
     *
     * @returns Absolute path to cache file
     */
    getCachePath(): string;
}
/**
 * CacheManager - Manages local metadata cache.
 *
 * Stores Live Dev metadata in `.runtime/runtime-awake-metadata.json`
 * to avoid repeated CloudFormation queries.
 *
 * @see Requirements 2.1, 2.2, 2.4, 2.5
 */
export declare class CacheManager implements ICacheManager {
    private readonly projectRoot;
    private readonly cacheFileName;
    private readonly cacheDir;
    private readonly cacheTtlMs;
    constructor(config: CacheConfig);
    /**
     * Get the absolute path to the cache file.
     *
     * @returns Absolute path to cache file
     */
    getCachePath(): string;
    /**
     * Get the absolute path to the cache directory.
     *
     * @returns Absolute path to cache directory
     */
    private getCacheDir;
    /**
     * Read cached metadata if valid.
     *
     * @returns Cache read result with data if found and valid
     *
     * @see Requirements 2.2, 2.5
     */
    read(): Promise<CacheReadResult>;
    /**
     * Write metadata to cache.
     *
     * Creates the cache directory if it doesn't exist.
     * Uses atomic write (write to temp file, then rename).
     *
     * @param metadata - Metadata to cache
     * @param stackName - Stack name used to load metadata
     *
     * @see Requirements 2.1, 2.4
     */
    write(metadata: RuntimeAwakeMetadata, stackName: string): Promise<void>;
    /**
     * Check if cache is fresh (within TTL).
     *
     * @returns True if cache exists and is fresh
     *
     * @see Requirements 2.2
     */
    isFresh(): Promise<boolean>;
    /**
     * Clear the cache by deleting the cache file.
     */
    clear(): Promise<void>;
    /**
     * Check if a cached timestamp is within TTL.
     *
     * @param cachedAt - ISO timestamp when cache was created
     * @returns True if cache is fresh
     */
    private isCacheFresh;
}
/**
 * Validate that an object is a valid CachedMetadata structure.
 *
 * @param data - Data to validate
 * @returns True if data is valid CachedMetadata
 *
 * @see Requirements 2.5
 */
export declare function isValidCachedMetadata(data: unknown): data is CachedMetadata;
/**
 * Validate that an object is a valid RuntimeAwakeMetadata structure.
 *
 * @param data - Data to validate
 * @returns True if data is valid RuntimeAwakeMetadata
 */
export declare function isValidRuntimeAwakeMetadata(data: unknown): data is RuntimeAwakeMetadata;
/**
 * Check if a timestamp string is a valid ISO date.
 *
 * @param timestamp - Timestamp string to validate
 * @returns True if timestamp is valid ISO date
 */
export declare function isValidIsoTimestamp(timestamp: string): boolean;
/**
 * Calculate cache age in milliseconds.
 *
 * @param cachedAt - ISO timestamp when cache was created
 * @returns Age in milliseconds, or -1 if invalid timestamp
 */
export declare function getCacheAge(cachedAt: string): number;
/**
 * Check if cache is stale based on TTL.
 *
 * @param cachedAt - ISO timestamp when cache was created
 * @param ttlMs - TTL in milliseconds
 * @returns True if cache is stale (age >= TTL)
 */
export declare function isCacheStale(cachedAt: string, ttlMs: number): boolean;
/**
 * Create a CacheManager instance.
 *
 * @param config - Cache configuration
 * @returns CacheManager instance
 */
export declare function createCacheManager(config: CacheConfig): ICacheManager;
