import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import { jwtConfig, DatabaseService } from '../../config';
import { PermissionResolverService } from '../../common/access-control/permission-resolver.service';
import { JwtStrategy } from '../owner/strategies/jwt.strategy';
import { AccessControlController } from './access-control.controller';
import { AccessControlService } from './access-control.service';

@Module({
  imports: [
    JwtModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: jwtConfig,
    }),
  ],
  providers: [AccessControlService, PermissionResolverService, DatabaseService, JwtStrategy],
  controllers: [AccessControlController],
  exports: [AccessControlService, PermissionResolverService],
})
export class AccessControlModule {}
