import { BadRequestException, HttpStatus } from '@nestjs/common';

/**
 * RFC 6749 §5.2 — `unsupported_grant_type`: authorization grant type is not supported
 * by the authorization server. Returned with HTTP 400.
 *
 * `statusCode` is included in the body so the NestJS Apollo driver's
 * `createTransformHttpErrorFn` sets `extensions.originalError`.
 */
export class UnsupportedGrantTypeError extends BadRequestException {
  constructor() {
    super({ statusCode: HttpStatus.BAD_REQUEST, error: 'unsupported_grant_type' });
  }
}
