import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { ConfigService } from '@nestjs/config';
import { ApplicationModule } from '@/application/application.module';
import { DomainModule } from '@/domain/domain.module';
import { HealthController, BalanceController, InternalController, DepositController, DepositRepairController } from './controllers';
import { JwtStrategy } from '@/shared/strategies/jwt.strategy';

@Module({
  imports: [
    ApplicationModule,
    DomainModule,
    PassportModule.register({ defaultStrategy: 'jwt' }),
    JwtModule.registerAsync({
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        secret: config.get<string>('JWT_SECRET') || 'default-secret',
        signOptions: { expiresIn: '7d' },
      }),
    }),
  ],
  controllers: [HealthController, BalanceController, InternalController, DepositController, DepositRepairController],
  providers: [JwtStrategy],
})
export class ApiModule {}
