<?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('phone', 20)->nullable()->unique()->after('email');
            $table->enum('role', ['admin', 'partner', 'customer'])->default('customer')->after('password');
            $table->boolean('is_partner_approved')->default(false);
            $table->string('avatar')->nullable();
            $table->text('address')->nullable();
            $table->string('city', 80)->nullable();
            $table->string('pincode', 12)->nullable();
            $table->decimal('lat', 10, 7)->nullable();
            $table->decimal('lng', 10, 7)->nullable();
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn(['phone', 'role', 'is_partner_approved', 'avatar', 'address', 'city', 'pincode', 'lat', 'lng']);
        });
    }
};
