<?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');
            $table->string('email');
            $table->string('phone', 30)->nullable();
            $table->string('company', 150)->nullable();
            $table->text('message');
            $table->enum('status', ['Novo', 'Em contato', 'Qualificado', 'Convertido', 'Perdido'])->default('Novo');
            $table->string('origem', 50)->default('site');
            $table->text('observacoes')->nullable();
            $table->timestamp('contactado_em')->nullable();
            $table->timestamps();

            $table->index('status');
            $table->index('created_at');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('leads');
    }
};
