<?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('scholarships', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->boolean('is_fully_funded')->default(false);   // ADDED
            $table->text('description');
            $table->text('eligibility');
            $table->date('deadline');
            $table->decimal('amount', 12, 2)->nullable();
            $table->foreignId('country_id')->constrained()->cascadeOnDelete();
            $table->foreignId('university_id')->nullable()->constrained()->nullOnDelete();
            $table->enum('program_level', ['bachelor', 'master', 'phd']);
            $table->foreignId('created_by')->constrained('users')->cascadeOnDelete();
            $table->string('scholarship_type')->nullable();       // ADDED
            $table->enum('status', ['draft', 'published', 'expired'])->default('draft');
            $table->string('slug')->unique();
            $table->text('meta_description')->nullable();
            $table->timestamps();

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

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