import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import { MongooseModule } from '@nestjs/mongoose';
import { NotificationsModule } from '../notifications/notifications.module';
import { StorageModule } from '../../infrastructure/storage/storage.module';
import { UsersModule } from '../users/users.module';
import { ChatController } from './chat.controller';
import { ChatGateway } from './chat.gateway';
import { ChatRealtimeService } from './chat-realtime.service';
import { ChatService } from './chat.service';
import { ChatRepository } from './chat.repository';
import { ChatBlock, ChatBlockSchema } from './schemas/chat-block.schema';
import { Conversation, ConversationSchema } from './schemas/conversation.schema';
import { Message, MessageSchema } from './schemas/message.schema';

@Module({
  imports: [
    ConfigModule,
    JwtModule.register({}),
    NotificationsModule,
    StorageModule,
    UsersModule,
    MongooseModule.forFeature([
      { name: Conversation.name, schema: ConversationSchema },
      { name: Message.name, schema: MessageSchema },
      { name: ChatBlock.name, schema: ChatBlockSchema },
    ]),
  ],
  controllers: [ChatController],
  providers: [ChatService, ChatRepository, ChatRealtimeService, ChatGateway],
  exports: [ChatService],
})
export class ChatModule {}
