<?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('navigation_links', function (Blueprint $table) {
            $table->id();

            $table->foreignId('parent_id')->nullable()->constrained('navigation_links');
            $table->foreignId('navigation_menu_id')->constrained('navigation_menus');
            $table->foreignId('page_id')->nullable()->constrained('pages');
            $table->integer('type')->default(1)->comment('1 link, 2 page');
            $table->text('title')->nullable();
            $table->text('description')->nullable();
            $table->text('url')->nullable();
            $table->string('target')->default('_self');
            $table->string('class')->nullable();
            $table->integer('ordernum')->default(0);

            $table->timestamps();
        });
    }

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