<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('results', function (Blueprint $table) {
            $table->integer('correct_answers')->default(0)->after('score');
            $table->integer('wrong_answers')->default(0)->after('correct_answers');
            $table->decimal('percentage', 5, 2)->default(0)->after('total_questions');
            $table->string('grade')->nullable()->after('percentage');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('results', function (Blueprint $table) {
            $table->dropColumn(['correct_answers', 'wrong_answers', 'percentage', 'grade']);
        });
    }
};
