import { Module } from '@nestjs/common';
import { APP_GUARD } from '@nestjs/core';
import { ConfigModule } from '@nestjs/config';
import { LoggerModule } from './plugins/logger/logger.module';
import { RedisModule } from './plugins/redis/redis.module';
import { MikroOrmConfigModule } from './plugins/mikro-orm/mikro-orm.module';
import { NacosConfigModule } from './plugins/nacos/nacos.module';
import { MeetingModule } from './modules/meeting/meeting.module';
import { WebsocketModule } from './modules/websocket/websocket.module';
import { AuthGuard } from './common/guards/auth.guard';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      envFilePath: ['.env.development', '.env.production'],
    }),
    // 全局基础设施模块
    LoggerModule,
    RedisModule,
    MikroOrmConfigModule,
    NacosConfigModule,
    // 业务模块
    MeetingModule,
    WebsocketModule,
  ],
  providers: [{ provide: APP_GUARD, useClass: AuthGuard }],
})
export class AppModule {}
