import { Document, Types } from "mongoose";

export interface IConversation extends Document {
  /** Exactly two user ObjectIds, sorted ascending for uniqueness */
  participants: Types.ObjectId[];
  lastMessageAt: Date | null;
  lastMessagePreview: string | null;
  /**
   * Per-user unread counts keyed by userId string.
   * Incremented for the recipient on new messages; reset to 0 when they open the thread.
   */
  unreadCounts: Map<string, number> | Record<string, number>;
  createdAt: Date;
  updatedAt: Date;
}
