import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { PalmOilModule } from './palm-oil/palm-oil.module';
import { SurveillanceModule } from './surveillance/surveillance.module';

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'sqlite',
      database: 'palm_history.db',
      autoLoadEntities: true,
      synchronize: true, // Auto-create tables (use only for development)
    }),
    PalmOilModule,
    SurveillanceModule,  // Lego 09 — boots PID polling on startup
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
