<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('proposals', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->longText('cover_letter');
            $table->longText('description');
            $table->double('amount')->nullable();
            $table->boolean('per_project')->default(true);
            $table->integer('duration');
            $table->foreignId('project_id')->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();
            $table->unsignedBigInteger('proposalable_id');
            $table->string('proposalable_type');
            $table->enum('status',['Pending Approval','Accepted','Declined'])->default('Pending Approval');
            $table->boolean('accepted')->nullable();
            $table->softDeletes();
        });
    }

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