<?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('settings', function (Blueprint $table) {
            $table->string('key')->primary();
            $table->text('value')->nullable();
        });

        // Insert some default settings
        DB::table('settings')->insert([
            ['key' => 'store_name', 'value' => 'E-Shop'],
            ['key' => 'contact_phone', 'value' => '6281234567890'],
            ['key' => 'contact_email', 'value' => 'support@eshop.com'],
            ['key' => 'store_address', 'value' => 'Jl. E-Commerce No. 1, Jakarta, Indonesia'],
            ['key' => 'midtrans_client_key', 'value' => ''],
            ['key' => 'midtrans_server_key', 'value' => ''],
            ['key' => 'midtrans_is_production', 'value' => 'false'],
            ['key' => 'fonnte_token', 'value' => ''],
            ['key' => 'google_client_id', 'value' => ''],
            ['key' => 'google_client_secret', 'value' => ''],
            ['key' => 'mail_host', 'value' => '127.0.0.1'],
            ['key' => 'mail_port', 'value' => '2525'],
            ['key' => 'mail_username', 'value' => ''],
            ['key' => 'mail_password', 'value' => ''],
            ['key' => 'mail_encryption', 'value' => 'null'],
            ['key' => 'mail_from_address', 'value' => 'hello@example.com'],
            ['key' => 'mail_from_name', 'value' => 'E-Shop'],
            ['key' => 'logo', 'value' => ''],
            ['key' => 'favicon', 'value' => ''],
        ]);
    }

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