<?php
/**
 * SIPIUTANG — Front Controller
 * Seluruh permintaan HTTP masuk melalui berkas ini.
 */

require dirname(__DIR__) . '/app/bootstrap.php';

use App\Core\Acl;
use App\Core\Auth;
use App\Core\Settings;
use App\Core\View;
use App\Services\ApprovalService;

// Data yang dibagikan ke semua tampilan
View::share('app_name',      Settings::str('umum.nama_aplikasi', 'SIPIUTANG'));
View::share('company_name',  Settings::str('umum.nama_perusahaan', 'PT Roto-Rooter Indonesia'));
View::share('app_version',   SIPIUTANG_VERSION);
View::share('menu',          Acl::menu());
View::share('current_user',  Auth::check() ? Auth::user() : null);
View::share('approval_badge', Auth::check() ? ApprovalService::pendingCount() : 0);

/** @var App\Core\Router $router */
$router = require dirname(__DIR__) . '/app/routes.php';
$router->dispatch();
