<?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::create('streamer_uploads', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('streamer_id');
            $table->string('image_path');
            $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
            $table->integer('gold_reward')->nullable()->comment('Gold amount awarded on approval');
            $table->text('admin_notes')->nullable()->comment('Optional notes from admin');
            $table->unsignedBigInteger('approved_by')->nullable()->comment('Admin user ID who approved/rejected');
            $table->timestamp('approved_at')->nullable();
            $table->timestamps();

            $table->foreign('streamer_id')->references('id')->on('streamers')->onDelete('cascade');
            $table->index('streamer_id');
            $table->index('status');
            $table->index('created_at');
        });
    }

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