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

            // কোন মেইন ক্যাটেগরি / মেনুর সাথে attach হবে
            $table->foreignId('menu_id')
                  ->constrained('menus')
                  ->onDelete('cascade');

            // Section title/subtitle (frontend e dekhabo)
            $table->string('title')->nullable();
            $table->string('subtitle')->nullable();

            // প্রতি সেকশনে কতোটা product দেখাবো
            $table->unsignedInteger('max_products')->default(8);

            // Section order (homepage e upor theke niche dekhano)
            $table->integer('order')->default(0);

            // Active / inactive
            $table->boolean('is_active')->default(true);

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

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