import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { SequelizeModule } from '@nestjs/sequelize';
import { UnidSaudeModule } from './unid-saude/unid-saude.module';
import configuration from './config/configuration';
import { ConfigModule } from '@nestjs/config';
import { AuthModule } from './auth/auth.module';
import { SobreDoencaController } from './sobre-doenca/sobre-doenca.controller';
import { SobreDoencaRepository } from './sobre-doenca/repository/sobre-doenca-repository';
import { TabGraficoController } from './tab-grafico/tab-grafico.controller';
import { TabDoencaRepository } from './tab-grafico/repository/tab-doenca-repository';

@Module({
  imports: [
    UnidSaudeModule,
    ConfigModule.forRoot({ load: [configuration], isGlobal: true }),
    SequelizeModule.forRoot({
      dialect: 'mysql',
      host: process.env.DATABASE_HOST,
      username: process.env.DATABASE_USER,
      password: process.env.DATABASE_PASSWORD,
      database: process.env.DATABASE_NAME,
      autoLoadModels: true,
      synchronize: true
    }),
    AuthModule
  ],
    
  controllers: [AppController, SobreDoencaController, TabGraficoController],
  providers: [AppService, SobreDoencaRepository, TabDoencaRepository],
})
export class AppModule {
}
