<?php

namespace App\Database\Seeds;

use CodeIgniter\Database\Seeder;

class SubjectsSeeder extends Seeder
{
    public function run()
    {
        $subjects = [
            // ==================== MI (Madrasah Ibtidaiyah) ====================
            ['name' => 'Pendidikan Pancasila', 'code' => 'PP', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Bahasa Indonesia', 'code' => 'BIN', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Matematika', 'code' => 'MTK', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'IPAS', 'code' => 'IPAS', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Seni dan Budaya', 'code' => 'SB', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'PJOK', 'code' => 'PJOK', 'level' => 'MI', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Al-Qur\'an Hadis', 'code' => 'QH', 'level' => 'MI', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Akidah Akhlak', 'code' => 'AA', 'level' => 'MI', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Fikih', 'code' => 'FIQ', 'level' => 'MI', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Sejarah Kebudayaan Islam', 'code' => 'SKI', 'level' => 'MI', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Bahasa Arab', 'code' => 'BA', 'level' => 'MI', 'group' => 'Keagamaan', 'is_core' => 1],

            // ==================== MTs (Madrasah Tsanawiyah) ====================
            ['name' => 'Pendidikan Pancasila', 'code' => 'PP', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Bahasa Indonesia', 'code' => 'BIN', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Matematika', 'code' => 'MTK', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'IPA', 'code' => 'IPA', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'IPS', 'code' => 'IPS', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Bahasa Inggris', 'code' => 'BIG', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Informatika', 'code' => 'INF', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Seni dan Budaya', 'code' => 'SB', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'PJOK', 'code' => 'PJOK', 'level' => 'MTs', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Al-Qur\'an Hadis', 'code' => 'QH', 'level' => 'MTs', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Akidah Akhlak', 'code' => 'AA', 'level' => 'MTs', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Fikih', 'code' => 'FIQ', 'level' => 'MTs', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Sejarah Kebudayaan Islam', 'code' => 'SKI', 'level' => 'MTs', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Bahasa Arab', 'code' => 'BA', 'level' => 'MTs', 'group' => 'Keagamaan', 'is_core' => 1],

            // ==================== MA (Madrasah Aliyah) ====================
            // Umum
            ['name' => 'Pendidikan Pancasila', 'code' => 'PP', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Bahasa Indonesia', 'code' => 'BIN', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Bahasa Inggris', 'code' => 'BIG', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Matematika', 'code' => 'MTK', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Sejarah Indonesia', 'code' => 'SJ', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Informatika', 'code' => 'INF', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'PJOK', 'code' => 'PJOK', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            ['name' => 'Seni dan Budaya', 'code' => 'SB', 'level' => 'MA', 'group' => 'Umum', 'is_core' => 1],
            
            // Keagamaan
            ['name' => 'Al-Qur\'an Hadis', 'code' => 'QH', 'level' => 'MA', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Akidah Akhlak', 'code' => 'AA', 'level' => 'MA', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Fikih', 'code' => 'FIQ', 'level' => 'MA', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Sejarah Kebudayaan Islam', 'code' => 'SKI', 'level' => 'MA', 'group' => 'Keagamaan', 'is_core' => 1],
            ['name' => 'Bahasa Arab', 'code' => 'BA', 'level' => 'MA', 'group' => 'Keagamaan', 'is_core' => 1],
            
            // Pilihan IPA
            ['name' => 'Biologi', 'code' => 'BIO', 'level' => 'MA', 'group' => 'Pilihan IPA', 'is_core' => 0],
            ['name' => 'Fisika', 'code' => 'FIS', 'level' => 'MA', 'group' => 'Pilihan IPA', 'is_core' => 0],
            ['name' => 'Kimia', 'code' => 'KIM', 'level' => 'MA', 'group' => 'Pilihan IPA', 'is_core' => 0],
            
            // Pilihan IPS
            ['name' => 'Ekonomi', 'code' => 'EKO', 'level' => 'MA', 'group' => 'Pilihan IPS', 'is_core' => 0],
            ['name' => 'Geografi', 'code' => 'GEO', 'level' => 'MA', 'group' => 'Pilihan IPS', 'is_core' => 0],
            ['name' => 'Sosiologi', 'code' => 'SOS', 'level' => 'MA', 'group' => 'Pilihan IPS', 'is_core' => 0],
            ['name' => 'Antropologi', 'code' => 'ANT', 'level' => 'MA', 'group' => 'Pilihan IPS', 'is_core' => 0],
            
            // Pilihan Lintas Minat
            ['name' => 'Bahasa Asing', 'code' => 'BAING', 'level' => 'MA', 'group' => 'Pilihan Lintas Minat', 'is_core' => 0],

            // ==================== Tambahan (Semua Jenjang) ====================
            ['name' => 'Muatan Lokal', 'code' => 'MULOK', 'level' => 'ALL', 'group' => 'Tambahan', 'is_core' => 0],
            ['name' => 'P5RA', 'code' => 'P5RA', 'level' => 'ALL', 'group' => 'Tambahan', 'is_core' => 0],
        ];

        foreach ($subjects as $subject) {
            $this->db->table('subjects')->insert($subject);
        }
    }
}