/**
 * Email Client
 *
 * Unified email client for IMAP/SMTP operations.
 * Note: This is a mock implementation as actual email requires external libraries.
 * In production, integrate with nodemailer (SMTP) and imap (IMAP) packages.
 */
import { EventEmitter } from 'events';
import type { ImapConfig, SmtpConfig, EmailMessage, EmailFolder, ImapSearchCriteria, ImapFetchOptions, SendMailOptions, SendMailResult, EmailFlag, EmailAddress } from './types.js';
export declare function parseEmailAddress(input: string | EmailAddress): EmailAddress;
export declare function formatEmailAddress(addr: EmailAddress): string;
export declare function generateMessageId(domain?: string): string;
export interface ImapClientEvents {
    'connected': () => void;
    'disconnected': () => void;
    'error': (error: Error) => void;
    'mail': (numNew: number) => void;
    'expunge': (uid: number) => void;
    'flags': (uid: number, flags: EmailFlag[]) => void;
}
export declare class ImapClient extends EventEmitter {
    private config;
    private connected;
    private selectedFolder;
    private idleTimeout;
    private mockFolders;
    private mockMessages;
    private nextUid;
    constructor(config: ImapConfig);
    private initializeMockData;
    /**
     * Connect to IMAP server
     */
    connect(): Promise<void>;
    /**
     * Disconnect from server
     */
    disconnect(): Promise<void>;
    /**
     * Check if connected
     */
    isConnected(): boolean;
    /**
     * List all folders
     */
    listFolders(): Promise<EmailFolder[]>;
    /**
     * Select a folder
     */
    selectFolder(path: string): Promise<EmailFolder>;
    /**
     * Get currently selected folder
     */
    getSelectedFolder(): string | null;
    /**
     * Create a folder
     */
    createFolder(path: string): Promise<EmailFolder>;
    /**
     * Delete a folder
     */
    deleteFolder(path: string): Promise<void>;
    /**
     * Search for messages
     */
    search(criteria: ImapSearchCriteria, _options?: ImapFetchOptions): Promise<number[]>;
    /**
     * Fetch messages by UID
     */
    fetch(uids: number | number[], _options?: ImapFetchOptions): Promise<EmailMessage[]>;
    /**
     * Fetch a single message
     */
    fetchOne(uid: number, options?: ImapFetchOptions): Promise<EmailMessage | null>;
    /**
     * Add flags to messages
     */
    addFlags(uids: number | number[], flags: EmailFlag | EmailFlag[]): Promise<void>;
    /**
     * Remove flags from messages
     */
    removeFlags(uids: number | number[], flags: EmailFlag | EmailFlag[]): Promise<void>;
    /**
     * Move messages to another folder
     */
    move(uids: number | number[], destFolder: string): Promise<void>;
    /**
     * Copy messages to another folder
     */
    copy(uids: number | number[], destFolder: string): Promise<void>;
    /**
     * Delete messages (move to trash or permanently delete)
     */
    delete(uids: number | number[], permanent?: boolean): Promise<void>;
    /**
     * Expunge deleted messages
     */
    expunge(): Promise<number[]>;
    /**
     * Start IDLE mode
     */
    idle(timeout?: number): Promise<void>;
    /**
     * Stop IDLE mode
     */
    stopIdle(): void;
    /**
     * Append a message to a folder
     */
    append(folder: string, message: Partial<EmailMessage>, flags?: EmailFlag[]): Promise<number>;
    /**
     * Add a mock message (for testing)
     */
    addMockMessage(folder: string, message: Partial<EmailMessage>): number;
    private ensureConnected;
    private ensureFolderSelected;
    private matchesCriteria;
    private updateFolderCounts;
}
export interface SmtpClientEvents {
    'connected': () => void;
    'disconnected': () => void;
    'error': (error: Error) => void;
    'sent': (result: SendMailResult) => void;
}
export declare class SmtpClient extends EventEmitter {
    private config;
    private connected;
    private sentMessages;
    constructor(config: SmtpConfig);
    /**
     * Connect to SMTP server
     */
    connect(): Promise<void>;
    /**
     * Disconnect from server
     */
    disconnect(): Promise<void>;
    /**
     * Check if connected
     */
    isConnected(): boolean;
    /**
     * Send an email
     */
    send(options: SendMailOptions): Promise<SendMailResult>;
    /**
     * Verify connection
     */
    verify(): Promise<boolean>;
    /**
     * Get sent messages (for testing)
     */
    getSentMessages(): SendMailResult[];
    /**
     * Clear sent messages (for testing)
     */
    clearSentMessages(): void;
    private ensureConnected;
}
