import type { ConversationEntity } from '../entities/conversation.entity';
import type { ConversationStatus } from '../value-objects/conversation-status.vo';

export const CONVERSATION_REPOSITORY = Symbol('CONVERSATION_REPOSITORY');

export interface CreateConversationDto {
  listingId?: string;
  subject?: string;
  participantUserIds: string[];
}

export interface IConversationRepository {
  create(dto: CreateConversationDto): Promise<ConversationEntity>;
  findById(id: string): Promise<ConversationEntity | null>;
  findByUserId(userId: string, limit?: number, offset?: number): Promise<ConversationEntity[]>;
  findExistingBetweenUsers(userIds: string[], listingId?: string): Promise<ConversationEntity | null>;
  updateStatus(id: string, status: ConversationStatus): Promise<void>;
  updateLastMessage(id: string, content: string, sentAt: Date): Promise<void>;
  incrementUnreadCount(conversationId: string, excludeUserId: string): Promise<void>;
  resetUnreadCount(conversationId: string, userId: string): Promise<void>;
  countByUserId(userId: string): Promise<number>;
}
