<?php

declare(strict_types=1);

namespace App\Middleware;

use App\Core\Auth;
use App\Core\Middleware;
use App\Core\Request;
use App\Core\Response;

final class AuthMiddleware implements Middleware
{
    public function handle(Request $request, callable $next): mixed
    {
        if (!Auth::check()) {
            return Response::redirect('/crm/public/login');
        }
        return $next();
    }
}
