import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ConsoleGateway } from './console.gateway';
import { NatsService } from '../../services/nats.service';

@Module({
  imports: [
    JwtModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        secret: config.get<string>('JWT_SECRET') || 'dev-secret',
        signOptions: { expiresIn: '24h' },
      }),
    }),
  ],
  providers: [ConsoleGateway, NatsService],
  exports: [ConsoleGateway],
})
export class ConsoleModule {}
