<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
      Schema::create('job_applications', function (Blueprint $table) {
    $table->id();

    $table->foreignId('career_id')
        ->constrained()
        ->cascadeOnDelete();

    $table->string('name');
    $table->string('email');
    $table->string('phone', 20)->nullable();
    $table->string('resume');

    // Application status workflow
    $table->tinyInteger('status')
        ->default(0)
        ->comment('0=New,1=Reviewed,2=Shortlisted,3=Rejected');

    // Optional: tracking (advanced use)
    $table->string('source')->default('Website');
    $table->ipAddress('ip_address')->nullable();
    $table->text('user_agent')->nullable();

    $table->timestamps();
});

    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('job_applications');
    }
};
