<?php

declare(strict_types=1);

namespace Builder\Core\Http\Controllers\Auth;

use Builder\Core\Foundation\Middleware\BuilderAuth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

final class ShowLoginController
{
    public function __invoke(Request $request): Response|RedirectResponse
    {
        if ($request->user(BuilderAuth::guard())) {
            return redirect()->route('builder.dashboard');
        }

        return Inertia::render('Auth/Login');
    }
}
