<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        // 1. Create moderation_reports table
        Schema::create('moderation_reports', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->string('type'); // Profile, Chat, Review, Image
            $table->string('reported_user_name');
            $table->string('reported_user_role'); // Worker, Sponsor
            $table->string('reported_user_avatar')->nullable();
            $table->string('reported_by_name');
            $table->string('reported_by_role'); // Worker, Sponsor
            $table->string('reported_by_avatar')->nullable();
            $table->string('reason');
            $table->string('priority'); // High, Medium, Low
            $table->string('status'); // Pending, In Review, Resolved
            $table->text('description')->nullable();
            $table->timestamp('reported_at');
            $table->timestamps();
        });

        // 2. Create disputes table
        Schema::create('disputes', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->string('party_one_name');
            $table->string('party_one_role'); // Worker, Sponsor
            $table->string('party_one_avatar')->nullable();
            $table->string('party_two_name');
            $table->string('party_two_role'); // Worker, Sponsor
            $table->string('party_two_avatar')->nullable();
            $table->string('type'); // Payment Issue, Behavior Issue, Working Conditions, Abuse/Harassment
            $table->string('reason');
            $table->string('priority'); // High, Medium, Low
            $table->string('status'); // Open, Under Review, Waiting Response, Resolved
            $table->string('assigned_to')->nullable();
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('moderation_reports');
        Schema::dropIfExists('disputes');
    }
};
