<?php

declare(strict_types=1);

namespace App\Framework\Core\Events;

use App\Framework\Core\ValueObjects\ClassName;
use App\Framework\Core\ValueObjects\Duration;
use App\Framework\Core\ValueObjects\Timestamp;
use App\Framework\Http\Request;
use App\Framework\Http\Response;

final readonly class AfterMiddlewareExecution
{
    public readonly Timestamp $timestamp;

    public function __construct(
        public Request $request,
        public Response $response,
        public ClassName $middlewareClass,
        public Duration $executionTime,
        ?Timestamp $timestamp = null,
        public array $context = []
    ) {
        $this->timestamp = $timestamp ?? Timestamp::now();
    }
}
