<?php

use App\Enums\ParticipateStatus;
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('hunt_participants', function (Blueprint $table) {
            $table->id();
            $table->foreignUuid('user_id')->constrained()->cascadeOnDelete();
            $table->foreignId('hunt_id')->constrained('hunts')->cascadeOnDelete();
            $table->unsignedSmallInteger('current_step_number')->default(1);
            $table->string('status')->default(ParticipateStatus::Registered->value);
            $table->timestamps();
        });
    }

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