import type { NotificationAuthor, NotificationItemData } from "./serverDataType/Notification.js"; type User = import("./User.js").User; /** * Item de notification fin. N'étend PAS BaseEntity : il garde la donnée brute, un backref * User (pour router les appels via callIsMe + endpointApi) et un backref manager (pour le recount). * Les drapeaux lu/vu sont réactifs (objet reactive({...}) — surface scalaire fiable). */ export declare class Notification { private readonly _data; private readonly _owner; private _manager; private readonly _state; constructor(data: NotificationItemData, owner: User, manager?: Notifications | null); static fromData(data: NotificationItemData, owner: User, manager?: Notifications | null): Notification; /** Lie l'item à son manager (appelé par le manager au wrap). */ _attach(manager: Notifications): this; get id(): string; get isUnread(): boolean; get isUnseen(): boolean; get data(): NotificationItemData; get author(): NotificationAuthor; get createdAt(): Date; _setReadLocal(): void; _setSeenLocal(): void; _restoreLocal(unread: boolean, unseen: boolean): void; /** Marque CET item comme lu : optimiste + rollback + recount manager. */ markRead(): Promise; /** Pas d'endpoint "seen" par item : flip local uniquement. */ markSeen(): void; toJSON(): NotificationItemData; } /** * Gestionnaire de notifications de l'utilisateur connecté. Accroché à User via `me.notifications`. * N'étend PAS BaseEntity. Items dans un tableau SIMPLE (jamais proxifié) ; seuls les scalaires * vivent dans un reactive({...}) (loadedUnreadCount, unseenTotal, cursor, hasMore, version). * Aucun effect/computed créé ici (pas d'API de dispose -> pas de fuite). */ export declare class Notifications { private readonly _owner; private readonly _pageSize; private _items; private readonly _state; constructor(owner: User, pageSize?: number); get items(): Notification[]; get loadedUnreadCount(): number; get unseenTotal(): number; get hasMore(): boolean; _recount(): void; private _wrap; private _commit; /** Première page (reset le curseur). Tri serveur : updated desc, 15/page. */ list({ indexMin }?: { indexMin?: number; }): Promise; /** Page suivante (curseur indexMin = nb d'items déjà chargés). Concatène par réassignation. */ loadMore(): Promise; /** Recharge depuis le début. */ refresh(): Promise; /** * Badge : total des NON-VUS via GET_NOTIFICATIONS_COUNT (refreshTimestamp = maintenant -> * liste vide + countNotif). Met à jour unseenTotal et le retourne. */ count(): Promise; /** * PUR : convertit des `NotificationItemData[]` plats (ex. cache React Query après * hydratation SSR) en `Notification[]` liées à l'utilisateur, SANS modifier l'état du * manager. À utiliser dans un `select` React Query (cache plat -> instances vivantes). */ toItems(data: NotificationItemData[]): Notification[]; markAllRead(): Promise; markAllSeen(): Promise; private _bulk; /** Supprime toutes les notifications de l'utilisateur + vide l'état local. */ clear(): Promise; toJSON(): NotificationItemData[]; restore(rawItems: NotificationItemData[]): this; static restore(rawItems: NotificationItemData[], owner: User): Notifications; } export {};