<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class EnsureActive
{
    public function handle(Request $request, Closure $next)
    {
        if ($request->user() && $request->user()->status === 'suspended') {
            return response()->json([
                'message' => 'Your account is suspended. Please contact support.',
                'suspended' => true,
            ], 403);
        }

        return $next($request);
    }
}