<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use App\Support\DberpAuditCorrelationContext;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\Response;

final class AssignDberpAuditCorrelation
{
    /**
     * @param  Closure(Request): Response  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        DberpAuditCorrelationContext::reset((string) Str::uuid());

        return $next($request);
    }
}
