<?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('event_registrations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('event_id')->constrained('events')->cascadeOnDelete();
            $table->string('full_name', 150);
            $table->string('email', 200);
            $table->string('phone', 30);
            $table->string('last_qualification', 120);
            $table->string('undergraduate_result', 60)->nullable();
            $table->string('ielts_status', 60)->nullable();
            $table->string('english_score', 60)->nullable();
            $table->string('status', 30)->default('new');
            $table->string('ip_address', 45)->nullable();
            $table->string('user_agent', 1000)->nullable();
            $table->timestamps();

            $table->index(['event_id', 'created_at']);
            $table->index('status');
            $table->index('phone');
        });
    }

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