<?php

namespace Lucent\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Lucent\Account\AuthService;

readonly class GuestMiddleware
{
    public function __construct(private AuthService $authService)
    {
    }

    public function handle(Request $request, Closure $next)
    {
        if ($this->authService->isLoggedIn()) {
            return redirect("/lucent");
        }
        return $next($request);
    }
}
