/**
 * Security Module
 *
 * Provides security services and guards
 */

import { Module, Global } from '@nestjs/common';
import { ThrottlerModule } from '@nestjs/throttler';
import { FileValidationService } from '../../application/services/file-validation.service';
import { BruteForceProtectionService } from '../../application/services/brute-force-protection.service';
import { CustomThrottlerGuard } from '../../application/guards/throttle.guard';
import { rateLimitConfig } from './security.config';

@Global()
@Module({
  imports: [
    // Rate limiting
    ThrottlerModule.forRoot([
      {
        ttl: rateLimitConfig.global.ttl * 1000, // Convert to milliseconds
        limit: rateLimitConfig.global.limit,
      },
    ]),
  ],
  providers: [FileValidationService, BruteForceProtectionService, CustomThrottlerGuard],
  exports: [
    FileValidationService,
    BruteForceProtectionService,
    CustomThrottlerGuard,
    ThrottlerModule,
  ],
})
export class SecurityModule {}
