import type { BlobRef, SyncAuthLeaseIssueRequest } from '@syncular/core';
import type { SyncularDatabase } from './database';
import type { MutationsApi } from './mutations';
import type { SyncularAuthLeaseRecord, SyncularBlobUploadQueueProcessOptions, SyncularBlobUploadQueueStats, SyncularClientEventSink, SyncularClientEventType, SyncularConflictResolution, SyncularConflictStats, SyncularConflictSummary, SyncularConnectionState, SyncularDiagnosticSnapshot, SyncularLifecycleState, SyncularNetworkStatusSource, SyncularOutboxStats, SyncularPresenceEntry, SyncularPresenceSink, SyncularRealtimeOptions, SyncularRuntimeClient, SyncularSubscriptionSpec, SyncularSyncRequestOptions, SyncularSyncResult } from './types';
export interface SyncularClientLifecycleOptions {
    initialSync?: boolean;
    realtime?: boolean | SyncularRealtimeOptions;
    syncOnRealtimeConnect?: boolean;
    pollIntervalMs?: number | false;
    network?: SyncularNetworkStatusSource | false;
    subscriptions?: readonly SyncularSubscriptionSpec[];
}
export interface SyncularClientStatus {
    lifecycle: SyncularLifecycleState;
    connection: SyncularConnectionState;
    outbox: SyncularOutboxStats | null;
    conflicts: SyncularConflictStats | null;
    isConnected: boolean;
    isSyncing: boolean;
    hasPendingMutations: boolean;
    hasConflicts: boolean;
    requiresAction: boolean;
}
export interface SyncularBlobClientLike {
    getUploadQueueStats(): Promise<SyncularBlobUploadQueueStats>;
    processUploadQueue(options?: SyncularBlobUploadQueueProcessOptions): Promise<{
        uploaded: number;
        failed: number;
    }>;
    retrieve(ref: BlobRef): Promise<Uint8Array>;
}
export interface SyncularPresenceClientLike {
    get<TMetadata = Record<string, unknown>>(scopeKey: string): SyncularPresenceEntry<TMetadata>[];
    join(scopeKey: string, metadata?: Record<string, unknown>): void;
    leave(scopeKey: string): void;
    updateMetadata(scopeKey: string, metadata: Record<string, unknown>): void;
    onChange<TMetadata = Record<string, unknown>>(listener: SyncularPresenceSink<TMetadata>): () => void;
}
export interface SyncularConflictsClientLike {
    list(): Promise<SyncularConflictSummary[]>;
    retryKeepLocal(id: string): Promise<string>;
    resolve(id: string, resolution: SyncularConflictResolution): Promise<void>;
}
export interface SyncularClientLike<DB> {
    db: SyncularDatabase<DB>['db'];
    dialect?: SyncularDatabase<DB>['dialect'] | unknown;
    mutations: MutationsApi<DB, any>;
    leasedMutations: MutationsApi<DB, any>;
    blobs: SyncularBlobClientLike;
    on<T extends SyncularClientEventType>(event: T, listener: SyncularClientEventSink<T>): () => void;
    getStatus(): SyncularClientStatus;
    setSubscriptions(subscriptions: readonly SyncularSubscriptionSpec[]): Promise<void>;
    resumeFromBackground(options?: SyncularSyncRequestOptions): Promise<SyncularSyncResult>;
    issueAuthLease(request: SyncAuthLeaseIssueRequest): Promise<SyncularAuthLeaseRecord>;
    upsertAuthLease(lease: SyncularAuthLeaseRecord): Promise<void>;
    authLease(leaseId: string): Promise<SyncularAuthLeaseRecord | null>;
    activeAuthLeases(actorId?: string | null, nowMs?: number): Promise<SyncularAuthLeaseRecord[]>;
    diagnosticSnapshot(): Promise<SyncularDiagnosticSnapshot>;
    presence: SyncularPresenceClientLike;
    conflicts: SyncularConflictsClientLike;
    start(): Promise<void>;
    stop(): Promise<void>;
    sync(): Promise<SyncularSyncResult>;
    close(): Promise<void>;
}
type LifecycleClient = Pick<SyncularRuntimeClient, 'addDiagnosticListener' | 'connectionState' | 'forceSubscriptionsBootstrap' | 'setSubscriptions' | 'startRealtime' | 'stopRealtime' | 'syncOnce'>;
export declare function getSyncularClientStatus(client: Pick<SyncularRuntimeClient, 'connectionState' | 'lifecycleState'>): SyncularClientStatus;
export declare class SyncularClientLifecycle {
    #private;
    private readonly client;
    private readonly options;
    constructor(client: LifecycleClient, options?: SyncularClientLifecycleOptions);
    start(): Promise<void>;
    stop(): Promise<void>;
    sync(): Promise<SyncularSyncResult>;
}
export {};
//# sourceMappingURL=client.d.ts.map