<?php
declare(strict_types=1);

// Compatibility bridge for the old "laporan_bulanan" route.
// The active monthly report implementation lives in modules/laporan/.
require_once __DIR__ . '/../config/database.php';
require_once __DIR__ . '/../config/app.php';

checkAuth();

$page = strtolower((string)($_GET['page'] ?? ''));
$level = strtolower((string)($_GET['level'] ?? ''));
$pageMap = [
    'kepala_unit' => 'unit_form',
    'unit' => 'unit_form',
    'kasubdiv' => 'kasubdiv_form',
    'kadiv' => 'kadiv_form',
];

if ($page === '' && isset($pageMap[$level])) {
    $_GET['page'] = $pageMap[$level];
} elseif ($page === '') {
    $_GET['page'] = 'unit_form';
}

require __DIR__ . '/laporan/index.php';
