<?php

use App\Enums\BonusStatusEnum;
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('bonuses', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(\App\Models\User::class, 'receiver_id')->constrained('users')->cascadeOnDelete();
            $table->foreignIdFor(\App\Models\User::class, 'sender_id')->constrained('users')->cascadeOnDelete();
            $table->float('coins');
            $table->enum('status', BonusStatusEnum::values())->default(BonusStatusEnum::PENDING);
            $table->string('remark')->nullable();
            $table->timestamps();
        });
    }

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