<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void {
        Schema::create('settings', function (Blueprint $table) {
            $table->id();
            $table->string('key')->unique();
            $table->text('value')->nullable();
            $table->timestamps();
        });

        // Seed default settings
        $defaults = [
            'store_name'        => 'LK Fashion',
            'store_tagline'     => 'Moda a seu estilo',
            'store_logo'        => '',
            'store_address'     => 'Maputo, Moçambique',
            'store_phone'       => '+258 84 000 0000',
            'store_email'       => 'info@lkfashion.com',
            'store_website'     => '',
            'store_description' => 'A melhor loja de moda em Moçambique.',
            'social_instagram'  => '',
            'social_facebook'   => '',
            'social_tiktok'     => '',
            'social_whatsapp'   => '',
            'social_youtube'    => '',
            'brand_color'       => '#dc2626',
            'brand_color_dark'  => '#b91c1c',
            'footer_text'       => '© 2026 LK Fashion. Todos os direitos reservados.',
            'currency'          => 'MZN',
            'currency_symbol'   => 'Mt',
        ];
        foreach ($defaults as $key => $value) {
            \DB::table('settings')->insert(['key' => $key, 'value' => $value, 'created_at' => now(), 'updated_at' => now()]);
        }
    }

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