<?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('users', function (Blueprint $table) {
            $table->string('role')->default('user')->index()->after('email');
            $table->unsignedBigInteger('points')->default(0)->index()->after('role');
            $table->text('bio')->nullable()->after('points');
            $table->string('avatar')->nullable()->after('bio');
            $table->string('phone')->nullable()->after('avatar');
            $table->enum('status', ['active', 'inactive', 'banned', 'suspended'])->default('active')->index()->after('phone');
            $table->timestamp('last_login_at')->nullable()->index()->after('status');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn(['role', 'points', 'bio', 'avatar', 'phone', 'status', 'last_login_at']);
        });
    }
};
