<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateMenuItemsTable extends Migration
{
    public function up()
    {
        Schema::create('menu_items', function (Blueprint $table) {
            $table->id();
            $table->string('label');
            $table->string('url');
            $table->unsignedTinyInteger('sort_order')->default(0);
            $table->boolean('is_active')->default(true);
            $table->string('target')->default('_self');
            $table->timestamps();
        });

        DB::table('menu_items')->insert([
            ['label' => 'হোম',            'url' => '/',              'sort_order' => 1, 'is_active' => 1, 'target' => '_self', 'created_at' => now(), 'updated_at' => now()],
            ['label' => 'যোগাযোগ',        'url' => '/contact',       'sort_order' => 2, 'is_active' => 1, 'target' => '_self', 'created_at' => now(), 'updated_at' => now()],
            ['label' => 'বিজ্ঞাপন মূল্য', 'url' => '/advertisement', 'sort_order' => 3, 'is_active' => 1, 'target' => '_self', 'created_at' => now(), 'updated_at' => now()],
        ]);
    }

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