<?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('pw_pvp', function (Blueprint $table) {
            $table->id();
            $table->integer('killer_id')->comment('ID of the killer');
            $table->integer('victim_id')->comment('ID of the victim');
            $table->string('killer_name')->nullable()->comment('Name of the killer');
            $table->string('victim_name')->nullable()->comment('Name of the victim');
            $table->integer('killer_level')->nullable();
            $table->integer('victim_level')->nullable();
            $table->integer('killer_class')->nullable();
            $table->integer('victim_class')->nullable();
            $table->string('location')->nullable()->comment('PVP location/map');
            $table->timestamp('pvp_time')->useCurrent()->comment('Time of PVP event');
            $table->timestamps();
            
            // Indexes for performance
            $table->index('killer_id');
            $table->index('victim_id');
            $table->index('pvp_time');
        });
    }

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