import type { Request, Response, NextFunction } from 'express';
import { Injectable, type NestMiddleware } from '@nestjs/common';

import { requestContextMiddleware } from '@adapters/http/RequestContext';

@Injectable()
export class RequestContextMiddleware implements NestMiddleware {
  use(req: Request, res: Response, next: NextFunction): void {
    requestContextMiddleware(req, res, next as NextFunction);
  }
}