<?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('first_name')->nullable()->after('name');
            $table->string('last_name')->nullable()->after('first_name');
            $table->string('phone_country_code', 10)->nullable()->after('email');
            $table->string('phone', 30)->nullable()->after('phone_country_code');
            $table->string('currency', 3)->default('USD')->after('phone');
            $table->string('country', 2)->nullable()->after('currency');
            $table->string('google_id')->nullable()->unique()->after('country');
            $table->string('avatar')->nullable()->after('google_id');
            $table->string('provider', 50)->nullable()->after('avatar');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropUnique(['google_id']);
            $table->dropColumn([
                'first_name', 'last_name', 'phone_country_code', 'phone', 'currency', 'country',
                'google_id', 'avatar', 'provider',
            ]);
        });
    }
};
