<?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('custom_cards', function (Blueprint $table) {
            $table->id();
            $table->string('title')->nullable();
            $table->text('description')->nullable();
            $table->string('image')->nullable();
            $table->string('bg_color')->default('#ffffff');
            $table->string('text_color')->default('#000000');
            
            // Grid positioning
            $table->integer('col_span')->default(1); // عرض: 1-6
            $table->integer('row_span')->default(1); // ارتفاع: 1-4
            
            // Link configuration
            $table->enum('link_type', ['none', 'internal', 'external', 'category', 'product'])->default('none');
            $table->string('link_url')->nullable();
            $table->integer('link_id')->nullable(); // برای category یا product
            
            // Display settings
            $table->boolean('is_active')->default(true);
            $table->integer('sort_order')->default(0);
            
            $table->timestamps();
        });
    }

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