<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('bonus_generations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('bonus_id')->constrained()->cascadeOnDelete();
            $table->string('month'); // e.g. "2025-03"
            $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
            $table->foreignId('generated_by')->constrained('users');
            $table->foreignId('approved_by')->nullable()->constrained('users');
            $table->timestamp('approved_at')->nullable();
            $table->timestamps();
        });
    }

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