<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::create('import_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('employee_id')->constrained()->onDelete('cascade');
            $table->string('import_file');
            $table->integer('row_number');
            $table->string('action'); // created, updated, dismissed
            $table->foreignId('imported_by')->constrained('users')->onDelete('cascade');
            $table->timestamp('imported_at');
            $table->json('data_snapshot')->nullable();
            $table->timestamps();
            
            $table->index('employee_id');
            $table->index('imported_at');
        });
    }

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