<?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('task_submissions', function (Blueprint $table) {
            $table->boolean('is_audited')->default(false)->after('task_label');
            $table->timestamp('audited_at')->nullable()->after('is_audited');
            $table->foreignId('audited_by')->nullable()->after('audited_at')->constrained('users')->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('task_submissions', function (Blueprint $table) {
            $table->dropConstrainedForeignId('audited_by');
            $table->dropColumn(['is_audited', 'audited_at']);
        });
    }
};
