# Conversation Module

This module provides chat and comment functionality for the ACoreX Platform.

## Service Architecture

The module follows the abstract service pattern with clear interface definitions:

### Comment System

- `AXMCommentService`: Abstract service defining the comment functionality contract
- `AXMCommentServiceImpl`: Concrete implementation of the comment service
- Types defined in `comment.type.ts`:
  - `AXMCommentUser`: User interface for comments
  - `AXMCommentMessage`: Extended message interface for comments
  - `AXMCommentRoom`: Room interface for comments
  - `AXMCreateCommentDto`: DTO for creating comments

### Chat System

- `AXMChatService`: Abstract service defining the chat functionality contract
- `AXMChatServiceImpl`: Concrete implementation of the chat service
- Types defined in `chat.type.ts`:
  - `AXMChatMember`: User interface for chat members
  - `AXMChatMessage`: Extended message interface for chat messages
  - `AXMChatRoom`: Room interface for chat rooms
  - `AXMCreateChatMessageDto`: DTO for creating chat messages
  - `AXMCreateChatRoomDto`: DTO for creating chat rooms

## Core Entities

The services build on core conversation entities:

- `AXMConversationMessage`: Base message entity
- `AXMConversationRoom`: Base room entity
- `AXMConversationAuthorDto`: Author information
- `AXMConversationContent`: Message content structure

## Features

### Comments

The comment system provides:

- Hierarchical comments with replies
- Reactions (likes)
- Formatted dates and content
- User avatars and information

### Chat

The chat system provides:

- Real-time messaging
- Message status (seen)
- Message reactions
- Room management
- Member management

## Dependencies

The module depends on the following services:

- `AXPSessionService`: For user information
- `AXMMessageService`: For base message operations
- `AXMRoomService`: For room management

## Usage

### Comment System

```typescript
// Get comment service
private commentService = inject(AXMCommentManagementService);

// Get comments
const response = await this.commentService.query({
  params: {
    entityId: 'entity-id',
    instanceId: 'instance-id'
  }
});

// Add comment
await this.commentService.insertOne({
  entityId: 'entity-id',
  instanceId: 'instance-id',
  content: 'Comment content',
  contentType: 'text'
});

// Like comment
await this.commentService.like('comment-id');
```

### Chat System

```typescript
// Get chat service
private chatService = inject(AXMChatManagementService);

// Get chat rooms
const { items } = await this.chatService.getAllChatRooms();

// Send message
await this.chatService.sendMessage(
  'room-id',
  'Message content',
  'text'
);

// Mark as read
await this.chatService.markChatAsRead('room-id');
```
