<?php

declare(strict_types=1);

namespace App\Http\Controllers\Support;

use App\Support\AppVersion;
use App\Http\Controllers\Admin\SystemSettingsController;

class Inertia
{
    public static function render(string $component, array $props = [])
    {
        // Add public system settings to every page load to avoid branding flutters
        $props['systemSettings'] = SystemSettingsController::getPublicSettingsData();

        return [
            'component' => $component,
            'props' => $props,
            'url' => $_SERVER['REQUEST_URI'] ?? '/',
            'version' => AppVersion::get(),
        ];
    }
}
