import { Module } from '@nestjs/common';
import { JWTService } from './jwt.service';
import { JwtModule as NestJWTModule } from '@nestjs/jwt';
import { JWTConfigService } from '../../../config/authentication/jwt/config.service';
import { JWTConfigModule } from '../../../config/authentication/jwt/config.module';

@Module({
  imports: [
    NestJWTModule.registerAsync({
      imports: [JWTConfigModule],
      useFactory: async (jwtConfigService: JWTConfigService) => ({
        secret: jwtConfigService.secret,
      }),
      inject: [JWTConfigService],
    }),
  ],
  providers: [JWTService],
  exports: [JWTService],
})
export class JWTModule {}
