import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import databaseType from './types/database.type';
import staticType from './types/static.type';
import { ConfigModule } from '@nestjs/config';
import UserModule from './module/user/user.module';
import { Proxy } from './proxy';
import StartupProvider from './startup.provider';
import CommonModule from './module/common/common.module';
import ArticleModule from './module/article/article.module';
import EventsModule from './module/events/events.module';
import MediaModule from './module/media/media.module';
import DocumentModule from './module/document/document.module';
import HelperModule from './module/helper/helper.module';
import InsightModule from './module/insight/insight.module';
import OllamaModule from './module/ollama/ollama.module';
import InvoiceModule from './module/invoice/invoice.module';

@Module(
  {
    imports: 
      [
        databaseType,
        staticType,
        ConfigModule.forRoot(),
        HelperModule,
        UserModule,
        CommonModule,
        ArticleModule,
        EventsModule,
        MediaModule,
        DocumentModule,
        InsightModule,
        InvoiceModule,
        OllamaModule
      ],
    providers: 
      [
        StartupProvider
      ]
  }
)
export class AppModule implements NestModule {

  configure(consumer: MiddlewareConsumer) {
    consumer.apply(Proxy).forRoutes("*");
  }

}
