<?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('flux_cms_navigations', function (Blueprint $table) {
            $table->id();
            $table->string('domain_key')->index();
            $table->string('name'); // z.B. 'main', 'footer', 'sidebar'
            $table->json('display_name'); // Übersetzbarer Anzeigename
            $table->json('settings')->nullable(); // Navigation-spezifische Einstellungen
            $table->boolean('is_active')->default(true);
            $table->timestamps();

            // Unique constraint
            $table->unique(['domain_key', 'name']);
            $table->index(['domain_key', 'is_active']);
        });
    }

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