<?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::create('ai_reviews', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id'); // Foreign key to user_profiles
            $table->unsignedBigInteger('document_id'); // Foreign key to research_documents
            $table->text('summary'); // Text of the AI-generated review
            $table->double('score'); // Rating given by the AI, if applicable
            $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending'); // Status of the review
            $table->text('grammer_feedback')->nullable(); // Grammar and style feedback from the AI
            $table->double('plagiarism_score')->nullable(); // Plagiarism check results
            $table->text('recommendations')->nullable(); // Feedback on plagiarism issues
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ai_reviews');
    }
};
