<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Menus extends BaseConfig
{
    /**
     * Menu items configuration.
     * Masing-masing item dapat berupa menu biasa atau section dengan sub-menu (collapse).
     * 
     * Masing-masing item mendukung properti:
     * - 'title': (string) Judul menu atau section.
     * - 'icon': (string) Kelas ikon Bootstrap.
     * - 'url': (string) URL halaman relatif.
     * - 'roles': (array) Daftar role yang diizinkan mengakses menu ini.
     * - 'conditions': (array) Kondisi khusus tambahan.
     * - 'is_section': (bool) Tentukan true jika berupa header section dengan collapse.
     * - 'is_flat': (bool) Jika true, render anak menu secara langsung tanpa collapse (untuk Guru/BK/TU).
     * - 'collapse_id': (string) ID HTML unik untuk grup collapse.
     * - 'children': (array) Daftar sub-menu jika berupa section.
     * - 'active_check': (string) Jenis pencocokan status aktif ('exact', 'prefix', 'contains', 'dashboard').
     */
    public array $menuItems = [
        [
            'title' => 'Dashboard',
            'icon' => 'bi bi-speedometer2',
            'url' => '/dashboard',
            'roles' => ['superadmin', 'admin', 'operator', 'guru', 'tata_usaha', 'siswa', 'kamad'],
            'active_check' => 'dashboard'
        ],

        // ── MENU KAMAD (KEPALA SEKOLAH) ────────────────────────────────
        [
            'title' => 'Pengawasan Sekolah',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuKamad',
            'roles' => ['kamad'],
            'children' => [
                [
                    'title' => 'Dashboard Pengawasan',
                    'icon' => 'bi bi-eye',
                    'url' => '/kamad/dashboard',
                    'roles' => ['kamad'],
                ],
                [
                    'title' => 'Jurnal KBM Hari Ini',
                    'icon' => 'bi bi-journal-check',
                    'url' => '/admin/kbm/hari-ini',
                    'roles' => ['kamad'],
                ],
                [
                    'title' => 'Rekap Pengaduan',
                    'icon' => 'bi bi-chat-dots',
                    'url' => '/admin/counseling',
                    'roles' => ['kamad'],
                ],
            ]
        ],
        
        // ADMINISTRASI (TU) - RENDER FLAT (TANPA COLLAPSE)
        [
            'title' => 'Administrasi',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuAdmTU',
            'roles' => ['tata_usaha'],
            'children' => [
                [
                    'title' => 'Cetak Presensi',
                    'icon' => 'bi bi-journal-check',
                    'url' => '/attendance-sheet',
                    'roles' => ['tata_usaha'],
                ],
                [
                    'title' => 'Tabungan Siswa',
                    'icon' => 'bi bi-piggy-bank',
                    'url' => '/tabungan',
                    'roles' => ['tata_usaha'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Laporan Tabungan',
                    'icon' => 'bi bi-bar-chart-line',
                    'url' => '/tabungan/report',
                    'roles' => ['tata_usaha'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // TABUNGAN (GURU)
        [
            'title' => 'Tabungan',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuTabunganGuru',
            'roles' => ['guru'],
            'children' => [
                [
                    'title' => 'Tabungan Siswa',
                    'icon' => 'bi bi-piggy-bank',
                    'url' => '/tabungan',
                    'roles' => ['guru'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Laporan Tabungan',
                    'icon' => 'bi bi-bar-chart-line',
                    'url' => '/tabungan/report',
                    'roles' => ['guru'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // SURAT RESMI (TU) - RENDER FLAT (TANPA COLLAPSE)
        [
            'title' => 'Surat Resmi',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuSuratTU',
            'roles' => ['tata_usaha'],
            'children' => [
                [
                    'title' => 'Riwayat Surat',
                    'icon' => 'bi bi-envelope-paper',
                    'url' => '/letter',
                    'roles' => ['tata_usaha'],
                ],
                [
                    'title' => 'Surat Keterangan Aktif',
                    'icon' => 'bi bi-file-earmark-text',
                    'url' => '/letter/keterangan-aktif',
                    'roles' => ['tata_usaha'],
                ],
                [
                    'title' => 'Surat Mutasi',
                    'icon' => 'bi bi-box-arrow-right',
                    'url' => '/letter/mutasi',
                    'roles' => ['tata_usaha'],
                ],
                [
                    'title' => 'Surat Tugas',
                    'icon' => 'bi bi-clipboard-check',
                    'url' => '/letter/surat-tugas',
                    'roles' => ['tata_usaha'],
                ],
                [
                    'title' => 'SPPD',
                    'icon' => 'bi bi-geo-alt-fill',
                    'url' => '/letter/sppd',
                    'roles' => ['tata_usaha'],
                ],
            ]
        ],

        // MENU GURU - RENDER FLAT (TANPA COLLAPSE)
        [
            'title' => 'Menu Guru',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuSayaGuru',
            'roles' => ['guru'],
            'conditions' => ['any_teaching_or_bk'],
            'children' => [
                [
                    'title' => 'Kelas dan Jadwal',
                    'icon' => 'bi bi-easel',
                    'url' => '/guru/kelas',
                    'roles' => ['guru'],
                    'conditions' => ['any_teaching_or_bk'],
                ],
                [
                    'title' => 'Perangkat Pembelajaran',
                    'icon' => 'bi bi-file-earmark-richtext',
                    'url' => '/guru/learning-devices',
                    'roles' => ['guru'],
                    'conditions' => ['is_teaching'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Jurnal Mengajar',
                    'icon' => 'bi bi-journal-bookmark',
                    'url' => '/guru/journal',
                    'roles' => ['guru'],
                    'conditions' => ['is_teaching'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'App Koreksi',
                    'icon' => 'bi bi-clipboard2-check',
                    'url' => '/guru/assessment',
                    'roles' => ['guru'],
                    'conditions' => ['is_teaching'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Poin Pelanggaran (BK)',
                    'icon' => 'bi bi-exclamation-triangle-fill',
                    'url' => '/bk/violations',
                    'roles' => ['guru'],
                    'conditions' => ['is_bk'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Pengaturan Poin (BK)',
                    'icon' => 'bi bi-sliders',
                    'url' => '/violation-settings',
                    'roles' => ['guru'],
                    'conditions' => ['is_bk'],
                ],
                [
                    'title' => 'E-Konseling & Aduan',
                    'icon' => 'bi bi-chat-dots',
                    'url' => '/guru/counseling',
                    'roles' => ['guru'],
                    'active_check' => 'prefix',
                ],
            ]
        ],
        
        // WALI KELAS - RENDER COLLAPSE
        [
            'title' => 'Wali Kelas',
            'is_section' => true,
            'collapse_id' => 'menuWalas',
            'roles' => ['guru'],
            'conditions' => ['is_homeroom'],
            'children' => [
                [
                    'title' => 'Daftar Siswa',
                    'icon' => 'bi bi-people-fill',
                    'url' => '/guru/siswa-kelas',
                    'roles' => ['guru'],
                    'conditions' => ['is_homeroom'],
                ],
                [
                    'title' => 'Rekap Presensi',
                    'icon' => 'bi bi-clipboard2-check',
                    'url' => '/guru/presensi-kelas',
                    'roles' => ['guru'],
                    'conditions' => ['is_homeroom'],
                ],
                [
                    'title' => 'Point Pelanggaran',
                    'icon' => 'bi bi-exclamation-triangle-fill',
                    'url' => '/guru/violations-kelas',
                    'roles' => ['guru'],
                    'conditions' => ['is_homeroom'],
                ],
            ]
        ],

        // TAHFIDZ AL-QUR'AN (GURU) - RENDER COLLAPSE
        [
            'title' => 'Tahfidz Al-Qur\'an',
            'is_section' => true,
            'collapse_id' => 'menuTahfidz',
            'roles' => ['guru'],
            'conditions' => ['is_tahfidz_teacher'],
            'children' => [
                [
                    'title' => 'Dashboard Tahfidz',
                    'icon' => 'bi bi-book-half',
                    'url' => '/guru/tahfidz',
                    'roles' => ['guru'],
                    'conditions' => ['is_tahfidz_teacher'],
                    'active_check' => 'exact',
                ],
                [
                    'title' => 'Input Setoran',
                    'icon' => 'bi bi-pencil-square',
                    'url' => '/guru/tahfidz/setoran',
                    'roles' => ['guru'],
                    'conditions' => ['is_tahfidz_teacher'],
                    'active_check' => 'prefix',
                ],
                [
                    'title' => 'Ceklis Hafalan',
                    'icon' => 'bi bi-check2-all',
                    'url' => '/guru/tahfidz/hafalan',
                    'roles' => ['guru'],
                    'conditions' => ['is_tahfidz_teacher'],
                    'active_check' => 'prefix',
                ],
                [
                    'title' => 'Progress Juz',
                    'icon' => 'bi bi-bar-chart-steps',
                    'url' => '/guru/tahfidz/progress',
                    'roles' => ['guru'],
                    'conditions' => ['is_tahfidz_teacher'],
                    'active_check' => 'prefix',
                ],
                [
                    'title' => 'Laporan',
                    'icon' => 'bi bi-clipboard-data',
                    'url' => '/guru/tahfidz/laporan',
                    'roles' => ['guru'],
                    'conditions' => ['is_tahfidz_teacher'],
                    'active_check' => 'prefix',
                ],
            ]
        ],

        // KALENDER AKADEMIK (GURU) - RENDER COLLAPSE
        [
            'title' => 'Kalender Akademik',
            'is_section' => true,
            'force_collapse' => true,
            'collapse_id' => 'menuKalenderGuru',
            'roles' => ['guru'],
            'conditions' => ['any_teaching_or_bk'],
            'children' => [
                [
                    'title' => 'Kalender Grid',
                    'icon' => 'bi bi-grid-3x3',
                    'url' => '/guru/academic-calendar/grid',
                    'roles' => ['guru'],
                    'conditions' => ['any_teaching_or_bk'],
                ],
                [
                    'title' => 'Kalender List',
                    'icon' => 'bi bi-list-ul',
                    'url' => '/guru/academic-calendar/list',
                    'roles' => ['guru'],
                    'conditions' => ['any_teaching_or_bk'],
                ],
            ]
        ],

        // ── ADMIN / SUPERADMIN MENU REORGANIZED ──────────────────────────

        // 1. AKADEMIK (ADMIN)
        [
            'title' => 'Akademik',
            'is_section' => true,
            'collapse_id' => 'menuAkademik',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Tahun & Periode',
                    'icon' => 'bi bi-calendar3-range',
                    'url' => '/academic-period',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Kalender Akademik',
                    'icon' => 'bi bi-calendar2-week',
                    'url' => '/academic-calendar',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 2. SISWA (ADMIN)
        [
            'title' => 'Siswa',
            'is_section' => true,
            'collapse_id' => 'menuSiswa',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Data Siswa',
                    'icon' => 'bi bi-people-fill',
                    'url' => '/student',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Assign Kelas',
                    'icon' => 'bi bi-person-plus',
                    'url' => '/class-assignment',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Pindah Kelas',
                    'icon' => 'bi bi-arrow-repeat',
                    'url' => '/move-class',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Kenaikan Kelas',
                    'icon' => 'bi bi-graph-up-arrow',
                    'url' => '/promote-class',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Riwayat Siswa',
                    'icon' => 'bi bi-archive',
                    'url' => '/student-history',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Alumni & Non-Aktif',
                    'icon' => 'bi bi-mortarboard',
                    'url' => '/student/alumni',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Point Pelanggaran',
                    'icon' => 'bi bi-exclamation-triangle-fill',
                    'url' => '/bk/violations',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Monitoring Kelengkapan',
                    'icon' => 'bi bi-card-checklist',
                    'url' => '/student/completeness',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Rekap Pengaduan',
                    'icon' => 'bi bi-chat-dots',
                    'url' => '/admin/counseling',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // 3. KELULUSAN (ADMIN)
        [
            'title' => 'Kelulusan',
            'is_section' => true,
            'collapse_id' => 'menuKelulusan',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Setting Kelulusan',
                    'icon' => 'bi bi-mortarboard-fill',
                    'url' => '/admin/graduation/settings',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Daftar Siswa',
                    'icon' => 'bi bi-person-check',
                    'url' => '/admin/graduation/students',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Upload SKL',
                    'icon' => 'bi bi-file-earmark-arrow-up',
                    'url' => '/admin/graduation/skl/upload',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 4. ADMINISTRASI (ADMIN)
        [
            'title' => 'Administrasi',
            'is_section' => true,
            'collapse_id' => 'menuAdm',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Cetak Presensi',
                    'icon' => 'bi bi-printer',
                    'url' => '/attendance-sheet',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Leger Nilai',
                    'icon' => 'bi bi-table',
                    'url' => '/leger-import',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'contains'
                ],
                [
                    'title' => 'Buku Induk',
                    'icon' => 'bi bi-journal-bookmark-fill',
                    'url' => '/buku-induk',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Kartu Pelajar',
                    'icon' => 'bi bi-person-badge',
                    'url' => '/student-card',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Administrasi Ujian',
                    'icon' => 'bi bi-pencil-square',
                    'url' => '/exam-event',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'App Koreksi',
                    'icon' => 'bi bi-clipboard2-check',
                    'url' => '/assessment',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Tabungan Siswa',
                    'icon' => 'bi bi-piggy-bank',
                    'url' => '/tabungan',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Laporan Tabungan',
                    'icon' => 'bi bi-bar-chart-line',
                    'url' => '/tabungan/report',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // 5. GURU & MAPEL (ADMIN)
        [
            'title' => 'Guru & Mapel',
            'is_section' => true,
            'collapse_id' => 'menuGuru',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Data Guru',
                    'icon' => 'bi bi-person-badge',
                    'url' => '/teacher',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Setting Mapel',
                    'icon' => 'bi bi-book',
                    'url' => '/school-subject',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Setting Mengajar',
                    'icon' => 'bi bi-person-workspace',
                    'url' => '/teaching-assignment',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Setting Guru BK',
                    'icon' => 'bi bi-heart-pulse',
                    'url' => '/bk-assignment',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Setting Wali Kelas',
                    'icon' => 'bi bi-person-standing',
                    'url' => '/homeroom-assignment',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 5b. TAHFIDZ AL-QUR'AN (ADMIN)
        [
            'title' => 'Tahfidz Al-Qur\'an',
            'is_section' => true,
            'collapse_id' => 'menuTahfidzAdmin',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Dashboard Tahfidz',
                    'icon' => 'bi bi-book',
                    'url' => '/admin/tahfidz/dashboard',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Program Tahfidz',
                    'icon' => 'bi bi-collection',
                    'url' => '/admin/tahfidz',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix',
                ],
            ]
        ],

        // 6. KBM (ADMIN)
        [
            'title' => 'KBM',
            'is_section' => true,
            'collapse_id' => 'menuKbm',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'KBM Hari Ini',
                    'icon' => 'bi bi-calendar-day',
                    'url' => '/admin/kbm/hari-ini',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Rekap Jurnal',
                    'icon' => 'bi bi-clipboard-data',
                    'url' => '/admin/kbm/rekap',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // 7. SURAT RESMI (ADMIN)
        [
            'title' => 'Surat Resmi',
            'is_section' => true,
            'collapse_id' => 'menuSuratAdmin',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Riwayat Surat',
                    'icon' => 'bi bi-envelope-paper',
                    'url' => '/letter',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Surat Keterangan Aktif',
                    'icon' => 'bi bi-file-earmark-text',
                    'url' => '/letter/keterangan-aktif',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Surat Mutasi',
                    'icon' => 'bi bi-box-arrow-right',
                    'url' => '/letter/mutasi',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Surat Tugas',
                    'icon' => 'bi bi-clipboard-check',
                    'url' => '/letter/surat-tugas',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'SPPD',
                    'icon' => 'bi bi-geo-alt-fill',
                    'url' => '/letter/sppd',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 8. JADWAL OTOMATIS (ADMIN) - RENDER COLLAPSIBLE
        [
            'title' => 'Jadwal Otomatis',
            'is_section' => true,
            'collapse_id' => 'menuJadwalOtomatis',
            'roles' => ['superadmin', 'admin'],
            'conditions' => ['local_schedule_only'],
            'children' => [
                [
                    'title' => 'Buat Jadwal',
                    'icon' => 'bi bi-lightning-charge',
                    'url' => '/schedule-generator',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // JADWAL ASC (ADMIN) - RENDER COLLAPSIBLE
        [
            'title' => 'Jadwal ASC',
            'is_section' => true,
            'collapse_id' => 'menuJadwalAsc',
            'roles' => ['superadmin', 'admin'],
            'conditions' => ['asc_schedule_only'],
            'children' => [
                [
                    'title' => 'Jadwal Pelajaran',
                    'icon' => 'bi bi-calendar3-week',
                    'url' => '/asc-schedule',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Import Jadwal',
                    'icon' => 'bi bi-file-earmark-arrow-up',
                    'url' => '/asc-import',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Sync Data',
                    'icon' => 'bi bi-arrow-repeat',
                    'url' => '/asc-sync',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // JADWAL MANUAL (ADMIN) - RENDER COLLAPSIBLE
        [
            'title' => 'Jadwal Manual',
            'is_section' => true,
            'collapse_id' => 'menuJadwalManual',
            'roles' => ['superadmin', 'admin'],
            'conditions' => ['manual_schedule_only'],
            'children' => [
                [
                    'title' => 'Input Jadwal',
                    'icon' => 'bi bi-pencil-square',
                    'url' => '/manual-schedule/input',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Template Jadwal',
                    'icon' => 'bi bi-calendar2-week',
                    'url' => '/manual-schedule',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // 9. ABSENSI BK (MANUAL)
        [
            'title' => 'Absensi BK',
            'is_section' => true,
            'collapse_id' => 'menuAbsensi',
            'roles' => ['superadmin', 'admin', 'guru'],
            'conditions' => ['bk_manual_allowed'],
            'children' => [
                [
                    'title' => 'Absensi Siswa',
                    'icon' => 'bi bi-clipboard-check',
                    'url' => '/attendance',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_manual_allowed'],
                ],
                [
                    'title' => 'Rekap Bulanan',
                    'icon' => 'bi bi-bar-chart',
                    'url' => '/attendance/rekap-bulanan',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_manual_allowed'],
                ],
                [
                    'title' => 'Rekap Semester',
                    'icon' => 'bi bi-bar-chart-steps',
                    'url' => '/attendance/rekap-semester',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_manual_allowed'],
                ],
            ]
        ],

        // ABSENSI QR CODE
        [
            'title' => 'Absensi QR Code',
            'is_section' => true,
            'collapse_id' => 'menuAbsensiQr',
            'roles' => ['superadmin', 'admin', 'operator', 'guru'],
            'conditions' => ['bk_qr_allowed'],
            'children' => [
                [
                    'title' => 'Scan QR Kehadiran',
                    'icon' => 'bi bi-qr-code-scan',
                    'url' => '/attendance/qr-scan',
                    'roles' => ['superadmin', 'admin', 'operator'],
                ],
                [
                    'title' => 'Rekap QR Harian',
                    'icon' => 'bi bi-list-check',
                    'url' => '/attendance/qr-report',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_qr_allowed'],
                ],
                [
                    'title' => 'Rekap Bulanan QR',
                    'icon' => 'bi bi-bar-chart-fill',
                    'url' => '/attendance/qr-rekap-bulanan',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_qr_allowed'],
                ],
                [
                    'title' => 'Rekap Semester QR',
                    'icon' => 'bi bi-clipboard-data',
                    'url' => '/attendance/qr-rekap-semester',
                    'roles' => ['superadmin', 'admin', 'guru'],
                    'conditions' => ['bk_qr_allowed'],
                ],
                [
                    'title' => 'Pengaturan QR Scan',
                    'icon' => 'bi bi-gear',
                    'url' => '/attendance/qr-settings',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 10. MASTER DATA (ADMIN)
        [
            'title' => 'Master Data',
            'is_section' => true,
            'collapse_id' => 'menuMaster',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Master Mapel',
                    'icon' => 'bi bi-journals',
                    'url' => '/subject',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Tingkat',
                    'icon' => 'bi bi-layers',
                    'url' => '/grade',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Jurusan',
                    'icon' => 'bi bi-collection',
                    'url' => '/major',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Kelas',
                    'icon' => 'bi bi-buildings',
                    'url' => '/classroom',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Master CP',
                    'icon' => 'bi bi-file-earmark-ruled',
                    'url' => '/cp-management',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
                [
                    'title' => 'Master Materi & TP',
                    'icon' => 'bi bi-journal-richtext',
                    'url' => '/tp-management',
                    'roles' => ['superadmin', 'admin'],
                    'active_check' => 'prefix'
                ],
            ]
        ],

        // 11. PENGATURAN (ADMIN)
        [
            'title' => 'Pengaturan',
            'is_section' => true,
            'collapse_id' => 'menuPengaturan',
            'roles' => ['superadmin', 'admin'],
            'children' => [
                [
                    'title' => 'Manajemen Akun',
                    'icon' => 'bi bi-person-gear',
                    'url' => '/user-management',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Pengaturan Lembaga',
                    'icon' => 'bi bi-building',
                    'url' => '/settings',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Portal Siswa',
                    'icon' => 'bi bi-window-sidebar',
                    'url' => '/settings/student-portal',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Pengaturan Point Pelanggaran',
                    'icon' => 'bi bi-sliders',
                    'url' => '/violation-settings',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Fitur Absensi',
                    'icon' => 'bi bi-toggle-on',
                    'url' => '/settings/attendance-features',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Pengaturan Jadwal',
                    'icon' => 'bi bi-calendar2-check',
                    'url' => '/settings/schedule',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Integrasi AI',
                    'icon' => 'bi bi-cpu',
                    'url' => '/settings/ai',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'WhatsApp (Sidobe)',
                    'icon' => 'bi bi-whatsapp',
                    'url' => '/settings/whatsapp',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Penyimpanan File',
                    'icon' => 'bi bi-cloud-arrow-up',
                    'url' => '/settings/storage',
                    'roles' => ['superadmin', 'admin'],
                ],
                [
                    'title' => 'Database',
                    'icon' => 'bi bi-database',
                    'url' => '/settings/database',
                    'roles' => ['superadmin', 'admin'],
                ],
            ]
        ],

        // 12. FLAT BOTTOM-LEVEL MENUS
        [
            'title' => 'Update Aplikasi',
            'icon' => 'bi bi-cloud-arrow-down',
            'url' => '/updater',
            'roles' => ['superadmin', 'admin'],
            'active_check' => 'prefix'
        ],
        [
            'title' => 'Logout',
            'icon' => 'bi bi-box-arrow-right',
            'url' => '/logout',
            'roles' => ['superadmin', 'admin', 'operator', 'guru', 'tata_usaha', 'siswa'],
        ],

        // PORTAL SISWA
        [
            'title' => 'Portal Siswa',
            'is_section' => true,
            'is_flat' => true,
            'collapse_id' => 'menuSiswaPortal',
            'roles' => ['siswa'],
            'children' => [
                [
                    'title' => 'Profil & Verifikasi',
                    'icon' => 'bi bi-person-badge',
                    'url' => '/siswa/profile',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Jadwal Pelajaran',
                    'icon' => 'bi bi-calendar2-week',
                    'url' => '/siswa/schedule',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Nilai Rapor',
                    'icon' => 'bi bi-file-earmark-bar-graph',
                    'url' => '/siswa/grades',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Kehadiran',
                    'icon' => 'bi bi-person-check',
                    'url' => '/siswa/attendance',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Tahfidz Al-Qur\'an',
                    'icon' => 'bi bi-book-half',
                    'url' => '/siswa/tahfidz',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Poin Pelanggaran',
                    'icon' => 'bi bi-exclamation-triangle-fill',
                    'url' => '/siswa/violations',
                    'roles' => ['siswa'],
                ],
                [
                    'title' => 'Pengaduan & Konseling',
                    'icon' => 'bi bi-chat-dots',
                    'url' => '/siswa/counseling',
                    'roles' => ['siswa'],
                    'active_check' => 'prefix',
                ],
                [
                    'title' => 'Ubah Password',
                    'icon' => 'bi bi-shield-lock',
                    'url' => '/siswa/change-password',
                    'roles' => ['siswa'],
                ],
            ]
        ],
    ];

}
