<?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::create('leads', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable();
            $table->string('email');
            $table->string('phone')->nullable();
            $table->enum('source', ['guide_download','survey','contact','meeting','template_order'])->default('guide_download');
            $table->string('business_name')->nullable();
            $table->string('business_type')->nullable();
            $table->string('revenue_range')->nullable();
            $table->text('notes')->nullable();
            $table->enum('status', ['new','contacted','qualified','converted','lost'])->default('new');
            $table->string('utm_source')->nullable();
            $table->string('utm_campaign')->nullable();
            $table->timestamp('contacted_at')->nullable();
            $table->timestamps();
            $table->index('email');
            $table->index('source');
            $table->index('status');
        });
    }
    public function down(): void
    {
        Schema::dropIfExists('leads');
    }
};
