<?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::table('ocr_question_results', function (Blueprint $table) {
            // Add manual_answer field for teacher to manually input/correct student answer
            $table->string('manual_answer', 10)->nullable()->after('student_answer')
                ->comment('Manually corrected student answer (overrides OCR result)');
            
            // Add flag to track if answer was manually verified
            $table->boolean('answer_verified')->default(false)->after('manual_answer')
                ->comment('Whether the answer has been manually verified by teacher');
        });
    }

    public function down(): void
    {
        Schema::table('ocr_question_results', function (Blueprint $table) {
            $table->dropColumn(['manual_answer', 'answer_verified']);
        });
    }
};
