<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void {
        Schema::create('riwayat_rekomendasis', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained('users')->cascadeOnDelete(); // Hilangkan komentar jika sudah pakai login Auth
            
            // Kolom Profil
            $table->integer('gaji_ortu');
            $table->integer('ekonomi_orang_tua'); // 0: Kurang, 1: Menengah, 2: Mampu
            $table->integer('minat_bakat');       // 0-3 sesuai dataset
            
            // 15 Nilai Mata Pelajaran
            $table->float('agama');
            $table->float('pkn');
            $table->float('bahasa_indonesia');
            $table->float('bahasa_inggris');
            $table->float('matematika');
            $table->float('fisika');
            $table->float('kimia');
            $table->float('biologi');
            $table->float('sejarah');
            $table->float('geografi');
            $table->float('ekonomi_mapel');
            $table->float('sosiologi');
            $table->float('seni_budaya');
            $table->float('pjok');
            $table->float('informatika');

            // Hasil Akhir
            $table->string('hasil_rekomendasi_jurusan')->nullable();
            $table->timestamps();
        });
    }

    public function down(): void {
        Schema::dropIfExists('riwayat_rekomendasis');
    }
};