import type { ManualUpdateInfo } from '../../shared/protocol.js';
import type { TerminalLayoutState } from '../../shared/types.js';
export interface StoredPasswordCredential {
    algorithm: 'scrypt';
    hash: string;
    salt: string;
    createdAt: string;
    updatedAt: string;
}
export interface StoredTotpCredential {
    secret: string;
    algorithm: 'SHA1';
    digits: 6;
    period: 30;
    createdAt: string;
}
export interface StoredAgent {
    id: string;
    name: string;
    url: string;
    token: string;
    createdAt: string;
}
export interface StoredTrustedDevice {
    id: string;
    tokenHash: string;
    label: string;
    createdAt: string;
    lastSeenAt: string;
    expiresAt: string;
}
export interface StoredIpRule {
    id: string;
    value: string;
    label: string;
    createdAt: string;
}
export interface StoredTerminalLayout {
    layout: TerminalLayoutState;
    revision: number;
    updatedAt: string;
}
export interface StoredNotificationAsset {
    id: string;
    filename: string;
    storedFilename: string;
    contentType: 'video/mp4' | 'video/webm';
    size: number;
    createdAt: string;
}
export type StoredManualUpdate = ManualUpdateInfo;
export interface StoredState {
    passwordCredential: StoredPasswordCredential | null;
    totpCredential: StoredTotpCredential | null;
    mainName: string | null;
    agents: StoredAgent[];
    trustedDevices: StoredTrustedDevice[];
    ipWhitelist: StoredIpRule[];
    terminalLayout: StoredTerminalLayout | null;
    agentLayouts: Record<string, StoredTerminalLayout>;
    notificationAssets: StoredNotificationAsset[];
    notificationAssetDisabledIds: string[];
    manualUpdate: StoredManualUpdate | null;
    agentManualUpdates: Record<string, StoredManualUpdate>;
}
export interface FileStoreOptions {
    coalesceWindowMs?: number;
    onError?: (err: unknown) => void;
}
export interface InitOptions {
    createIfMissing?: boolean;
}
export interface UpdateOptions {
    flush?: 'immediate' | 'coalesced';
}
export interface CheckpointOptions {
    validateSnapshot?: (snapshot: StoredState) => void;
}
export declare class FileStore {
    readonly path: string;
    private memoryState;
    private dirty;
    private flushTimer;
    private updateQueue;
    private readonly coalesceWindowMs;
    private onError;
    constructor(path: string, options?: FileStoreOptions);
    setErrorHandler(handler: (err: unknown) => void): void;
    init(options?: InitOptions): Promise<void>;
    read(): Promise<StoredState>;
    update(updater: (state: StoredState) => StoredState | Promise<StoredState>, options?: UpdateOptions): Promise<StoredState>;
    flush(): Promise<void>;
    checkpoint(options?: CheckpointOptions): Promise<{
        snapshot: StoredState;
        disk: StoredState;
    }>;
    flushSync(): void;
    private flushDirty;
    private scheduleFlush;
    private cancelTimer;
    private readFromDisk;
    private writeToDisk;
    private enqueue;
}
