import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import Joi from 'joi';
import { AuthModule } from './auth/auth.module';
import { BranchModule } from './branch/branch.module';
import { CommonsModule } from './commons/commons.module';
import { CustomerModule } from './customer/customer.module';
import { ExportModule } from './export/export.module';
import { NoteModule } from './note/notes.module';
import { PrintModule } from './print/print.module';
import { PrismaModule } from './prisma/prisma.module';
import { RoleModule } from './role/role.module';
import { SettingsModule } from './settings/settings.module';
import { TempUploadModule } from './transactions/temp-upload.module';
import { TransactionsModule } from './transactions/transactions.module';
import { UserModule } from './user/user.module';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      validationSchema: Joi.object({
        JWT_SECRET: Joi.string().required(),
        JWT_EXPIRES_IN: Joi.string().required(),
        PORT: Joi.number().required(),
        NODE_ENV: Joi.string().required(),
        DATABASE_URL: Joi.string().required(),
        CLIENT_URL: Joi.string().required(),
      }),
    }), AuthModule, UserModule, PrismaModule, SettingsModule, CommonsModule, PrintModule, BranchModule, TransactionsModule, TempUploadModule, CustomerModule, NoteModule, RoleModule, ExportModule],
  controllers: [],
  providers: [],
})
export class AppModule { }
