import { Resource } from '@/entities/resource.entity';
import { Module } from '@nestjs/common';
import { DiscoveryModule } from '@nestjs/core';
import { TypeOrmModule } from '@nestjs/typeorm';
import { FeatureScannerService } from './services/feature-scanner.service';
import { AdminAuthorService } from './services/implements/user-author.service';
import { ResourceService } from '../resources/resource.service';
import { Role } from '@/entities/role.entity';
import { Permission } from '@/entities/permission.entity';
import { RoleAuthor } from '@/entities/role-author.entity';
import { ResourcePermission } from '@/entities/resource-permission.entity';
import { ResourcesModule } from '../resources/resources.module';
import { User } from '@/entities/user.entity';
import { RolesModule } from '../roles/roles.module';

@Module({
  imports: [
    DiscoveryModule,
    ResourcesModule,
    RolesModule,
    TypeOrmModule.forFeature([
      Resource,
      User,
      Role,
      Permission,
      RoleAuthor,
      ResourcePermission,
    ]),
  ],
  providers: [FeatureScannerService, ResourceService, AdminAuthorService],
  exports: [ResourceService, AdminAuthorService, ResourceService],
})
export class AuthorizationModule {}
