import type { DB } from '../db/client.js'; export interface PreferenceStoreOptions { db: DB; } export interface SetOptions { /** If provided, reject the call when `value` is not in this list. */ allowed?: readonly string[]; } export declare class PreferenceStore { readonly db: DB; constructor({ db }: PreferenceStoreOptions); /** * Read a preference. Returns `defaultValue` if the user has no row for `key`. */ get(whatsapp: string, key: string, defaultValue?: string | null): Promise; /** * Upsert a preference. If `allowed` is supplied, rejects values not in it * (returns false without writing). */ set(whatsapp: string, key: string, value: string, { allowed }?: SetOptions): Promise; clear(whatsapp: string, key: string): Promise; /** * Fetch all preferences for one user as a key→value map. * Missing keys are simply absent — supply your own defaults. */ getAll(whatsapp: string): Promise>; } /** * Define a typed preference for ergonomic call sites. * * const deliveryMode = definePreference('delivery_mode', 'both', ['text', 'audio', 'both'] as const); * await deliveryMode.get(prefs, '5551'); // 'both' (default) * await deliveryMode.set(prefs, '5551', 'audio'); // validates */ export declare function definePreference(key: string, defaultValue: T, allowed?: readonly T[]): { key: string; defaultValue: T; allowed: readonly T[] | undefined; get(store: PreferenceStore, whatsapp: string): Promise; set(store: PreferenceStore, whatsapp: string, value: T): Promise; }; //# sourceMappingURL=preference_store.d.ts.map