import { Module } from '@nestjs/common';
import { SystemService } from './service/system.service';
import { SystemController } from './controller/system.controller';

import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entities/user.entity';
import { Org } from './entities/org.entity';
import { Role } from './entities/role.entity';
import { Feature } from './entities/feature.entity';
import { UserService } from './service/user.service';
import { JwtModule } from '@nestjs/jwt';
import { APP_GUARD } from '@nestjs/core';
import { JwtAuthGuard } from './jwt/jwt-auth.guard';
import { PassportModule } from '@nestjs/passport';
import { JwtStrategy } from './jwt/jwt.strategy';
import { OrgController } from './controller/org.controller';
import { OrgService } from './service/org.service';
import { FeatureService } from './service/feature.service';
import { FeatureController } from './controller/feature.controller';
import { RoleController } from './controller/role.controller';
import { RoleService } from './service/role.service';
import { UserController } from './controller/user.controller';
import { TeacherStudent } from './entities/teacher-student.entity';

@Module({
  imports: [
    TypeOrmModule.forFeature([User, Org, Role, Feature, TeacherStudent]),
    PassportModule,
    JwtModule.register({
      secret: 'jwtConstants.secret',
      signOptions: { expiresIn: '7d' },
    }),
  ],

  controllers: [
    SystemController,
    UserController,
    OrgController,
    FeatureController,
    RoleController,
  ],

  providers: [
    SystemService,
    UserService,
    OrgService,
    FeatureService,
    RoleService,
    JwtStrategy,
    {
      provide: APP_GUARD,
      useClass: JwtAuthGuard,
    },
  ],
})
export class SystemModule {}
