<?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('disputes', function (Blueprint $table) {
            if (!Schema::hasColumn('disputes', 'admin_notes')) {
                $table->text('admin_notes')->nullable();
            }
            if (!Schema::hasColumn('disputes', 'chat_logs')) {
                $table->longText('chat_logs')->nullable();
            }
        });

        Schema::table('moderation_reports', function (Blueprint $table) {
            if (!Schema::hasColumn('moderation_reports', 'admin_notes')) {
                $table->text('admin_notes')->nullable();
            }
        });
    }

    public function down(): void
    {
        Schema::table('disputes', function (Blueprint $table) {
            $table->dropColumn(['admin_notes', 'chat_logs']);
        });

        Schema::table('moderation_reports', function (Blueprint $table) {
            $table->dropColumn('admin_notes');
        });
    }
};
