import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ThrottlerModule } from '@nestjs/throttler';
import { ApiModule } from './api/api.module';
import { InfrastructureModule } from './infrastructure/infrastructure.module';

@Module({
  imports: [
    // 配置模块
    ConfigModule.forRoot({
      isGlobal: true,
      envFilePath: ['.env.local', '.env', '../.env'],
    }),

    // 限流模块
    ThrottlerModule.forRoot([
      {
        ttl: 60000,  // 1 minute
        limit: 10,   // 10 requests per minute
      },
    ]),

    // 基础设施模块
    InfrastructureModule,

    // API 模块
    ApiModule,
  ],
})
export class AppModule {}
