<?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('users', function (Blueprint $table) {
            $table->string('user_id', 10)->unique()->after('id');
            $table->enum('role', ['USER', 'MODERATOR', 'ADMIN', 'SUPERUSER'])->default('USER')->after('remember_token');
            $table->boolean('is_banned')->default(false)->after('role');
            $table->text('ban_reason')->nullable()->after('is_banned');
            $table->timestamp('ban_date')->nullable()->after('ban_reason');
            $table->string('pending_email')->nullable()->after('email');
            $table->enum('theme_preference', ['light', 'dark'])->default('light')->after('ban_date');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn([
                'user_id',
                'role',
                'is_banned',
                'ban_reason',
                'ban_date',
                'pending_email',
                'theme_preference'
            ]);
        });
    }
};