<?php

namespace Licenzo\Http\Middleware;

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

use Licenzo\Framework\Http\Request;
use Licenzo\Framework\Http\Response;

class Authenticate
{
    /**
     * Handle an incoming request.
     */
    public function handle(Request $request, \Closure $next)
    {
        // Basic WordPress authentication check
        if (!current_user_can('manage_options')) {
            return new Response([
                'success' => false,
                'message' => 'Unauthorized access'
            ], 401);
        }

        return $next($request);
    }
}
