<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

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

        // Insert default settings
        DB::table('ingame_service_settings')->insert([
            ['key' => 'teleport_price', 'value' => '0', 'description' => 'Price for teleport service (in gold)', 'created_at' => now(), 'updated_at' => now()],
            ['key' => 'teleport_enabled', 'value' => '1', 'description' => 'Enable/disable teleport service', 'created_at' => now(), 'updated_at' => now()],
            ['key' => 'max_meridian_price', 'value' => '100', 'description' => 'Price for max meridian service (in gold)', 'created_at' => now(), 'updated_at' => now()],
            ['key' => 'max_meridian_enabled', 'value' => '1', 'description' => 'Enable/disable max meridian service', 'created_at' => now(), 'updated_at' => now()],
        ]);
    }

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