<?php

use App\Models\NavigationMenu;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        // Seed default header menu items
        if (NavigationMenu::where('position', 'header')->count() === 0) {
            NavigationMenu::create([
                'name' => 'Home',
                'link_url' => '/',
                'position' => 'header',
                'sort_order' => 1,
                'is_active' => true,
            ]);

            NavigationMenu::create([
                'name' => 'Shop',
                'link_url' => '/shop',
                'position' => 'header',
                'sort_order' => 2,
                'is_active' => true,
            ]);
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        NavigationMenu::where('position', 'header')
            ->whereIn('name', ['Home', 'Shop'])
            ->delete();
    }
};
