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

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

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

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

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

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

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

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

    'yoga/uploads/qrcode/',
    'yoga/uploads/foto/',

    'yoga/vendor/phpqrcode/',
    'yoga/vendor/fpdf/',

    'yoga/index.php',
    'yoga/.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 'yoga/' berhasil dibuat!</strong>";
?>
