import { HttpStatus, Injectable } from '@nestjs/common';
import { ThrottlerGuard } from '@nestjs/throttler';
import { ErrorResponse } from '../../../config';

@Injectable()
export class LoginThrottlerGuard extends ThrottlerGuard {
  protected throwThrottlingException(): Promise<void> {
    throw new ErrorResponse(
      'Too many login attempts. Please try again later.',
      HttpStatus.TOO_MANY_REQUESTS,
    );
  }
}
