<?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('header_footer_settings', function (Blueprint $table) {
            $table->id();
            
            // Header Settings
            $table->string('header_bg_color')->default('#ffffff');
            $table->string('header_text_color')->default('#1f2937');
            $table->string('header_link_color')->default('#3b82f6');
            $table->string('header_link_hover_color')->default('#2563eb');
            $table->string('logo_text')->default('فروشگاه');
            $table->string('logo_image')->nullable();
            
            // Footer Settings
            $table->string('footer_bg_color')->default('#111827');
            $table->string('footer_text_color')->default('#9ca3af');
            $table->string('footer_heading_color')->default('#ffffff');
            $table->string('footer_link_color')->default('#9ca3af');
            $table->string('footer_link_hover_color')->default('#ffffff');
            $table->text('footer_description')->nullable();
            $table->string('footer_copyright')->default('© ۱۴۰۳ فروشگاه آنلاین · تمامی حقوق محفوظ است');
            
            // Contact Info
            $table->string('phone')->nullable();
            $table->string('email')->nullable();
            $table->string('address')->nullable();
            $table->string('social_instagram')->nullable();
            $table->string('social_telegram')->nullable();
            $table->string('social_whatsapp')->nullable();
            
            $table->timestamps();
        });
        
        // Menu items table
        Schema::create('menu_items', function (Blueprint $table) {
            $table->id();
            $table->enum('location', ['header', 'footer'])->default('header');
            $table->string('title');
            $table->string('link');
            $table->string('icon')->nullable(); // emoji or icon class
            $table->integer('sort_order')->default(0);
            $table->boolean('is_active')->default(true);
            $table->boolean('open_in_new_tab')->default(false);
            $table->string('group')->nullable(); // For footer column grouping
            $table->timestamps();
        });
    }

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