/**
 * Sync manager — extracted from android-bootstrap.ts for use in both
 * main-thread and Worker contexts.
 *
 * Platform-specific dependencies are injected:
 *   - emitEvent: posts events to the UI
 *   - vlog: verbose remote logging
 *   - createTcpTransport: factory for TCP transport (BridgeTcpTransport or WorkerTcpTransport)
 */
import type { WebMailxDB } from "./db.js";
import type { WebMessageStore } from "./web-message-store.js";
import type { WebSyncManager } from "./web-service.js";
import type { Folder, AccountConfig } from "@bobfrankston/mailx-types";
export interface SyncManagerDeps {
    emitEvent: (event: any) => void;
    vlog: (msg: string) => void;
    createTcpTransport: () => any;
}
export declare class SyncManager implements WebSyncManager {
    private db;
    private bodyStore;
    private providers;
    private tokenProviders;
    private deps;
    constructor(db: WebMailxDB, bodyStore: WebMessageStore, deps: SyncManagerDeps);
    on(_event: string, _handler: (...args: any[]) => void): void;
    emit(event: string, ...args: any[]): void;
    addAccount(account: AccountConfig): Promise<void>;
    setTokenProvider(accountId: string, provider: () => Promise<string>): void;
    private isGmailAccount;
    private getProvider;
    syncAll(): Promise<void>;
    syncAccount(accountId: string): Promise<void>;
    syncFolders(accountId: string): Promise<Folder[]>;
    syncFolder(accountId: string, folderId: number): Promise<void>;
    private storeProviderMessages;
    fetchMessageBody(accountId: string, folderId: number, uid: number): Promise<Uint8Array | null>;
    /** Publish a Store event AND the legacy emitEvent() shape until every
     *  consumer subscribes via storeBus. Same shape as the desktop side —
     *  that's the load-bearing property for cross-platform code sharing. */
    private publishStore;
    updateFlagsLocal(accountId: string, uid: number, folderId: number, flags: string[]): Promise<void>;
    trashMessage(accountId: string, folderId: number, uid: number): Promise<void>;
    trashMessages(accountId: string, messages: {
        uid: number;
        folderId: number;
    }[]): Promise<void>;
    moveMessage(accountId: string, uid: number, folderId: number, targetFolderId: number): Promise<void>;
    moveMessages(accountId: string, messages: {
        uid: number;
        folderId: number;
    }[], targetFolderId: number): Promise<void>;
    moveMessageCrossAccount(): Promise<void>;
    undeleteMessage(accountId: string, uid: number, folderId: number): Promise<void>;
    /** Q112: drain queued move/flag/trash actions to the provider. Android is
     *  standalone — it pushes state changes to Gmail (or other provider) the
     *  same way desktop does, so local actions propagate without needing a
     *  desktop to relay them. Called from android-bootstrap on startup and
     *  every 2-min sync tick. `send` actions are drained separately by
     *  processSendQueue. */
    processSyncActions(accountId: string): Promise<void>;
    markFolderRead(folderId: number): Promise<void>;
    emptyFolder(accountId: string, folderId: number): Promise<void>;
    queueOutgoingLocal(accountId: string, rawMessage: string): void;
    private sendViaSmtpDirect;
    saveDraft(_accountId: string, _raw: string, _prevUid?: number, _draftId?: string): Promise<number | null>;
    deleteDraft(_accountId: string, _uid: number): Promise<void>;
    reauthenticate(_accountId: string): Promise<boolean>;
    searchOnServer(_accountId: string, _query: string): Promise<any[]>;
    syncAllContacts(): Promise<void>;
}
//# sourceMappingURL=sync-manager.d.ts.map