<?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('headers', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable();              // Name of the header/menu item
            $table->string('link')->nullable();              // Link URL
            $table->string('slug')->nullable();              // Slug (for URL matching or SEO)
            $table->boolean('status')->default(true);        // Show/hide status
            $table->integer('position')->default(0);         // Position for ordering
            $table->foreignId('parent_id')->nullable()->constrained('headers')->nullOnDelete(); // Self-reference

            // Apply Now Section
             // Button link

            $table->softDeletes();                           // Soft delete support
            $table->timestamps();                            // Created_at, updated_at
        });
    }

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