import type { IdObject, DateValue } from "./common.js"; import type EJSONType from "../../EJSONType.js"; import type { Organization } from "../Organization.js"; import type { User } from "../User.js"; type ObjectIDCtor = typeof EJSONType["ObjectID"]; type ObjectID = InstanceType; /** * Auteur d'un commentaire (version brute de l'API) */ export interface CommentAuthorJson { id: string; name: string; username?: string; email?: string; profilImageUrl?: string; profilThumbImageUrl?: string; typeSig?: string; [k: string]: unknown; } /** * Auteur d'un commentaire (version normalisée côté client) */ export interface CommentAuthor extends CommentAuthorJson { type?: string; } /** * Vues d'un commentaire (qui a vu et quand) */ export interface CommentViews { [userId: string]: { date: DateValue; [k: string]: unknown; }; } /** * Structure JSON brute retournée par l'API */ export interface CommentItemJson { _id: IdObject; collection: "comments"; contextId: string; contextType: string; parentId: string; text: string; created: DateValue; author: CommentAuthorJson; tags?: string[] | null; status: string; views?: CommentViews; postedDate: number; markdownActive: boolean; argval?: string; replies?: CommentItemJson[]; [key: string]: unknown; } /** * Structure normalisée utilisée côté client * Les dates sont converties en objets Date * Le champ author peut être une instance d'entité (User ou Organization) */ export interface CommentItemNormalized { id: string; _id: ObjectID; collection: "comments"; contextId: string; contextType: string; parentId: string; text: string; created: Date; author: CommentAuthor | User | Organization; tags?: string[] | null; status: string; views?: Record; postedDate: number; markdownActive: boolean; argval?: string; replies?: CommentItemNormalized[]; [key: string]: unknown; } export {};