import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Permission } from './entities/permission.entity';
import { Role } from './entities/role.entity';
import { User } from './entities/user.entity';
import { AppConfigsModule } from './modules/app-configs/app-configs.module';
import { ProductsModule } from './modules/products/products.module';
import { ExistsInDatabaseValidator } from './system/validators/exists-in-database.validator';
import { UniqueInDatabaseVarlidator } from './system/validators/unique-in-database.decorator';
import { EventsModule } from './modules/events/events.module';
import { MediasModule } from './modules/medias/medias.module';

@Module({
  imports: [
    TypeOrmModule.forFeature([User, Role, Permission]),
    AppConfigsModule,
    // AuthenticationModule,
    // UsersModule,
    // AuthorizationModule,
    // ResourcesModule,
    // RolesModule,
    MediasModule,
    ProductsModule,
    EventsModule,
  ],
  controllers: [],
  providers: [ExistsInDatabaseValidator, UniqueInDatabaseVarlidator],
})
export class AppModule {
  // configure(consumer: MiddlewareConsumer) {
  //   consumer
  //     .apply(UserAuthMiddleware, AdminAuthorMiddleware)
  //     .exclude(...RouteExclusions.all())
  //     .forRoutes({ path: 'admin/*path', method: RequestMethod.ALL });
  // }
}
