<?php
$structure = [
    'nabila/assets/css/tailwind.min.css',
    'nabila/assets/js/jquery.min.js',
    'nabila/assets/js/html5-qrcode.min.js',
    'nabila/assets/js/script.js',
    'nabila/assets/img/logo.png',

    'nabila/includes/config.php',
    'nabila/includes/functions.php',
    'nabila/includes/header.php',
    'nabila/includes/footer.php',
    'nabila/includes/sidebar.php',

    'nabila/modules/auth/login.php',
    'nabila/modules/auth/logout.php',
    'nabila/modules/auth/ganti_password.php',

    'nabila/modules/dashboard/index.php',

    'nabila/modules/karyawan/index.php',
    'nabila/modules/karyawan/tambah.php',
    'nabila/modules/karyawan/edit.php',
    'nabila/modules/karyawan/hapus.php',
    'nabila/modules/karyawan/detail.php',

    'nabila/modules/absensi/index.php',
    'nabila/modules/absensi/scan.php',
    'nabila/modules/absensi/riwayat.php',
    'nabila/modules/absensi/laporan.php',

    'nabila/modules/qrcode/index.php',
    'nabila/modules/qrcode/generate.php',
    'nabila/modules/qrcode/cetak.php',

    'nabila/modules/penggajian/index.php',
    'nabila/modules/penggajian/proses.php',
    'nabila/modules/penggajian/slip.php',
    'nabila/modules/penggajian/laporan.php',

    'nabila/uploads/qrcode/',
    'nabila/uploads/foto/',

    'nabila/vendor/phpqrcode/',
    'nabila/vendor/fpdf/',

    'nabila/index.php',
    'nabila/.htaccess',
];

foreach ($structure as $path) {
    $dir = dirname($path);

    if (!is_dir($dir)) {
        mkdir($dir, 0755, true);
        echo "Folder dibuat: $dir<br>";
    }

    // Buat file kosong jika bukan folder
    if (substr($path, -1) !== '/') {
        if (!file_exists($path)) {
            file_put_contents($path, '');
            echo "File dibuat: $path<br>";
        }
    }
}

echo "<br><strong>Struktur folder dan file 'nabila/' berhasil dibuat!</strong>";
?>
