<?php

declare(strict_types=1);

namespace App\Core\Middleware;

use App\Core\Auth;
use App\Core\Response;

final class GuestMiddleware implements MiddlewareInterface
{
    public function handle(callable $next): mixed
    {
        if (Auth::check()) {
            Response::redirect('/dashboard');
        }

        return $next();
    }
}
