<?php

use App\Enums\CooperationStatus;
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('cooperations', function (Blueprint $table) {
            $table->id();
            $table->string('title', 200);
            $table->date('initial_submission_date');
            $table->date('final_submission_date');
            $table->date('assignment_deadline')->nullable();
            $table->date('verification_deadline')->nullable();
            $table->text('description');
            $table->unsignedInteger('payment_amount')->nullable();
            $table->date('payment_date')->nullable();
            $table->enum('status', [CooperationStatus::values()])->default(CooperationStatus::PENDING)->comment(CooperationStatus::comment());
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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