<?php

namespace App\Http\Controllers\Admin;

use App\Actions\System\CheckSystemHealth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\View\View;

/**
 * Admin → System Health. A read-only diagnostics board that tells the
 * operator (or support) at a glance whether the install is in good shape:
 * application config, database, storage, background jobs, PHP/server
 * requirements, and optional integrations. See {@see CheckSystemHealth}.
 */
class SystemHealthController extends Controller
{
    public function index(Request $request, CheckSystemHealth $check): View
    {
        abort_unless($request->user()?->hasPermission('settings.view'), 403);

        return view('admin.settings.system-health', ($check)());
    }
}
