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 { InitializationService } from './services/initialization.service';
import { DashboardService } from './services/dashboard.service';
import { UsersService } from './services/users.service';
import { SystemAccountsService } from './services/system-accounts.service';

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

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