<?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('inquiries', function (Blueprint $table) {
            $table->id();
            $table->branchColumn();
            $table->string('inquiry_number', 40)->unique();
            $table->string('student_name');
            $table->string('parent_name')->nullable();
            $table->string('contact', 30);
            $table->string('email')->nullable();
            $table->foreignId('class_id')->nullable()->constrained('classes')->nullOnDelete();
            $table->string('source', 60)->nullable();      // walk-in, phone, website, referral
            $table->enum('status', ['new', 'contacted', 'visited', 'converted', 'lost'])->default('new')->index();
            $table->date('follow_up_date')->nullable();
            $table->text('notes')->nullable();
            $table->auditColumns();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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