<?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('quiz_user_levels', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(\App\Models\UserQuiz::class)->constrained('user_quizzes')->cascadeOnDelete();
            $table->foreignIdFor(\App\Models\QuestionLevel::class)->constrained('question_levels')->cascadeOnDelete();
            $table->enum('status', \App\Enums\UserQuizStatusEnum::values())->default(\App\Enums\UserQuizStatusEnum::PENDING);
            $table->timestamps();
        });
    }

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