<?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): void {
            $table->string('role')->default('client')->index()->after('email');
            $table->string('phone')->nullable()->after('role');
            $table->string('avatar_url')->nullable()->after('phone');
            $table->text('bio')->nullable()->after('avatar_url');
            $table->json('payment_method')->nullable()->after('bio');
            $table->json('payout_method')->nullable()->after('payment_method');
            $table->boolean('is_kyc_verified')->default(false)->after('payout_method');
            $table->timestamp('last_seen_at')->nullable()->after('is_kyc_verified');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table): void {
            $table->dropColumn([
                'role',
                'phone',
                'avatar_url',
                'bio',
                'payment_method',
                'payout_method',
                'is_kyc_verified',
                'last_seen_at',
            ]);
        });
    }
};
