import { HttpClient } from '@angular/common/http';
import { AuthService } from '../auth/auth.service';
import { ValtechAuthConfig } from '../auth/types';
import { FirestoreService } from '../firebase/firestore.service';
import { I18nService } from '../i18n/i18n.service';
import { ThemeService } from '../theme.service';
import { FontSizeService } from '../font-size/font-size.service';
import { PreferencesFontSize, PreferencesLanguage, PreferencesTheme, PreferencesUpdate, PreferencesUpdateResponse } from './preferences.types';
import * as i0 from "@angular/core";
/**
 * PreferencesService — preferencias del user en el doc canónico Firestore
 * `/apps/{appId}/users/{uid}/preferences/main`.
 *
 * Read reactivo (signals) via listener Firestore.
 * Write via `PUT /v2/auth/preferences` (cliente NUNCA escribe Firestore directo —
 * ver memoria `feedback_no_direct_firestore_writes`).
 *
 * Side-effects automáticos:
 * - Cuando `theme()` cambia → `ThemeService.Theme = ...`
 * - Cuando `language()` cambia → `I18nService.setLanguage(...)`
 *
 * Auto-bind al user actual via `AuthService.user()`. Sin user (logout) → unbind.
 */
export declare class PreferencesService {
    private config;
    private firestore;
    private auth;
    private http;
    private themeService;
    private fontSizeService;
    private i18n;
    private readonly _theme;
    private readonly _language;
    private readonly _fontSize;
    private readonly _notificationsMaster;
    /** `true` después del primer snapshot Firestore. Antes, defaults sin side-effects. */
    private readonly _synced;
    readonly theme: import("@angular/core").Signal<PreferencesTheme>;
    readonly language: import("@angular/core").Signal<PreferencesLanguage>;
    readonly fontSize: import("@angular/core").Signal<PreferencesFontSize>;
    readonly notificationsMaster: import("@angular/core").Signal<boolean>;
    readonly synced: import("@angular/core").Signal<boolean>;
    private subscription?;
    private currentUserId?;
    /**
     * `true` mientras un `update()` está en vuelo (PUT al backend).
     *
     * El listener Firestore (`bindToUser`) es real-time y puede emitir un snapshot
     * *stale* — anterior al sync del backend — que pisaría el valor optimista de
     * `_notificationsMaster` y revertiría el toggle. Mientras este flag esté `true`
     * el listener ignora las emisiones; el `update()` ya alinea las señales con la
     * respuesta del backend al terminar.
     */
    private _updateInFlight;
    constructor(config: ValtechAuthConfig, firestore: FirestoreService, auth: AuthService, http: HttpClient, themeService: ThemeService | null, fontSizeService: FontSizeService | null, i18n: I18nService | null);
    /** Actualiza preferencias via backend. Optimistic UI: aplica local, revierte si falla. */
    update(partial: PreferencesUpdate): Promise<PreferencesUpdateResponse>;
    setTheme(theme: PreferencesTheme): Promise<PreferencesUpdateResponse>;
    setLanguage(language: PreferencesLanguage): Promise<PreferencesUpdateResponse>;
    setFontSize(fontSize: PreferencesFontSize): Promise<PreferencesUpdateResponse>;
    setNotificationsMaster(enabled: boolean): Promise<PreferencesUpdateResponse>;
    private bindToUser;
    private unbind;
    static ɵfac: i0.ɵɵFactoryDeclaration<PreferencesService, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
    static ɵprov: i0.ɵɵInjectableDeclaration<PreferencesService>;
}
