<?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('vendors', function (Blueprint $table) {
            $table->string('vendor_type')->nullable(); // service_provider, food_vendor, ride_provider, delivery_personnel, other
            $table->string('country')->nullable();
            $table->string('currency')->nullable();
            $table->string('language')->nullable();
            $table->string('referral_code')->nullable();
            
            $table->decimal('latitude', 10, 8)->nullable();
            $table->decimal('longitude', 11, 8)->nullable();
            $table->decimal('service_radius', 8, 2)->nullable();
            
            $table->enum('profile_status', ['incomplete', 'completed'])->default('incomplete');
        });
        
        // Also update kyc_documents enum
        // Since sqlite/mysql don't easily allow enum modifications in older versions, we can change the column type to string
        Schema::table('kyc_documents', function (Blueprint $table) {
            $table->string('document_type')->change();
        });
    }

    public function down(): void
    {
        Schema::table('vendors', function (Blueprint $table) {
            $table->dropColumn([
                'vendor_type', 'country', 'currency', 'language', 'referral_code',
                'latitude', 'longitude', 'service_radius', 'profile_status'
            ]);
        });
    }
};
