<?php

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

/**
 * Raw FiveM server/resource log lines pushed from Lua via the REST API
 * (see routes/api.php) — distinct from `audit_logs` (admin panel actions
 * taken through this app) and `discord_logs` (Discord-side events).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('server_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('fivem_server_id')->constrained()->cascadeOnDelete();
            $table->string('level')->default('info');
            $table->text('message');
            $table->timestamp('created_at')->useCurrent();
        });
    }

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