import { Module, OnModuleInit } from '@nestjs/common';
import { InfrastructureModule } from '../infrastructure/infrastructure.module';
import { AuthService } from './services/auth.service';
import { ConfigManagementService } from './services/config.service';
import { DashboardService } from './services/dashboard.service';
import { UsersService } from './services/users.service';
import { SystemAccountsService } from './services/system-accounts.service';
import { DailyReportService } from './services/daily-report.service';
import { ManualMiningService } from './services/manual-mining.service';

@Module({
  imports: [InfrastructureModule],
  providers: [
    AuthService,
    ConfigManagementService,
    DashboardService,
    UsersService,
    SystemAccountsService,
    DailyReportService,
    ManualMiningService,
  ],
  exports: [
    AuthService,
    ConfigManagementService,
    DashboardService,
    UsersService,
    SystemAccountsService,
    DailyReportService,
    ManualMiningService,
  ],
})
export class ApplicationModule implements OnModuleInit {
  constructor(private readonly authService: AuthService) {}

  async onModuleInit() {
    await this.authService.createDefaultAdmin();
  }
}
