<?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('applications', function (Blueprint $table) {
            $table->id();
            $table->string('folio')->unique();
            $table->enum('type', ['particular', 'radomiro']);
            $table->enum('status', ['pending', 'review', 'approved', 'rejected'])->default('pending');
            $table->string('full_name');
            $table->string('rut', 20);
            $table->string('email');
            $table->string('phone', 30);
            $table->date('application_date');
            $table->json('data');
            $table->json('attachments')->nullable();
            $table->text('admin_notes')->nullable();
            $table->timestamps();
            $table->index(['type', 'status']);
        });
    }

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