import Redis from 'ioredis';

interface LinkPreviewInitOptions {
    redis?: Redis;
    cacheMaxAge?: number;
    requestTimeout?: number;
    maxRedirects?: number;
    httpHeaders?: Record<string, string>;
}

interface LinkPreviewData {
    title?: string;
    desc?: string;
    image?: string;
    url?: string;
    siteName?: string;
}

/**
 * LinkPreview class handles fetching and caching of link preview data
 * with support for both Redis and in-memory caching.
 */
declare class LinkPreview {
    private readonly redis?;
    private readonly nodeCache?;
    private readonly cacheMaxAge;
    private readonly cacheEnabled;
    private readonly requestTimeout;
    private readonly maxRedirects;
    private readonly httpHeaders?;
    /**
     * Creates a new LinkPreview instance
     * @param options Configuration options for link preview fetching and caching
     */
    constructor(options: LinkPreviewInitOptions);
    /**
     * Fetches preview data for a given URL
     * @param url The URL to fetch preview data for
     * @returns Promise containing the preview data
     */
    getLinkPreview(url: string): Promise<LinkPreviewData | null>;
    /**
     * Extracts metadata from a given document
     * @param document The document to extract metadata from
     * @param url The URL of the document
     * @returns The extracted metadata
     */
    private extractMetadata;
    /**
     * Converts an HTML string to a cheerio document
     * @param html The HTML string to convert
     * @returns The converted cheerio document or null if conversion fails
     */
    private responseToDocument;
    /**
     * Fetches data from a given URL with redirects
     * @param url The URL to fetch data from
     * @returns The fetched data
     */
    private fetchWithRedirects;
    /**
     * Fetches data from a given YouTube video ID
     * @param videoId The YouTube video ID to fetch data from
     * @returns The fetched data
     */
    private getYoutubeData;
}

export { LinkPreview as default };
