<?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('ocr_question_results', function (Blueprint $table) {
            $table->integer('ai_score')->nullable()->after('answer_confidence')->comment('AI分析得分');
            $table->text('ai_feedback')->nullable()->after('ai_score')->comment('AI分析反馈');
            $table->decimal('ai_confidence', 5, 3)->nullable()->after('ai_feedback')->comment('AI分析置信度');
            $table->string('ai_analysis_method', 50)->nullable()->after('ai_confidence')->comment('AI分析方法');
            $table->timestamp('ai_analyzed_at')->nullable()->after('ai_analysis_method')->comment('AI分析时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('ocr_question_results', function (Blueprint $table) {
            $table->dropColumn([
                'ai_score',
                'ai_feedback',
                'ai_confidence',
                'ai_analysis_method',
                'ai_analyzed_at'
            ]);
        });
    }
};
