import { ConfigService } from '@nestjs/config';
import { JwtModuleOptions } from '@nestjs/jwt';

export const jwtConfig = (configService: ConfigService): JwtModuleOptions => ({
  secret: configService.get<string>('JWT_SECRET', 'default-secret-change-me'),
  signOptions: {
    expiresIn: configService.get<string>('JWT_EXPIRES_IN', '7d'),
  },
});

export const jwtRefreshConfig = (configService: ConfigService) => ({
  secret: configService.get<string>(
    'JWT_REFRESH_SECRET',
    'default-refresh-secret',
  ),
  expiresIn: configService.get<string>('JWT_REFRESH_EXPIRES_IN', '30d'),
});
