<?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::table('streamers', function (Blueprint $table) {
            $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending')->after('is_active');
            $table->unsignedBigInteger('character_id')->nullable()->after('user_id');
            $table->string('discord_id')->nullable()->after('code');
            $table->string('channel_link')->nullable()->after('discord_id');
            $table->timestamp('requested_at')->nullable()->after('status');
            $table->timestamp('processed_at')->nullable()->after('requested_at');
            
            $table->index('status');
            $table->index('character_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('streamers', function (Blueprint $table) {
            $table->dropColumn([
                'status',
                'character_id',
                'discord_id',
                'channel_link',
                'requested_at',
                'processed_at',
            ]);
        });
    }
};
