<?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('commitments', function (Blueprint $table) {
            $table->id();
            $table->foreignId('project_id')->nullable()->constrained('projects')->nullOnDelete();
            $table->foreignId('besluit_id')->nullable()->constrained('besluiten')->nullOnDelete();
            $table->text('beschrijving');
            $table->foreignId('eigenaar_id')->constrained('users')->restrictOnDelete();
            $table->date('deadline');
            $table->enum('status', ['open', 'in_uitvoering', 'afgerond', 'verlopen'])->default('open');
            $table->string('bron')->nullable();
            $table->timestamps();
        });
    }

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