<?php

use App\Enums\RegistrationStatus;
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('course_registration_submission_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('submission_id')->constrained('course_registration_submissions')->cascadeOnDelete();
            $table->enum('status', RegistrationStatus::values());
            $table->text('reason')->nullable();
            $table->foreignId('actor_id')->nullable()->constrained('users')->nullOnDelete();
            $table->timestamps();
        });
    }

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