<?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::table('projects', function (Blueprint $table) {
            $table->foreignId('handover_document_id')->nullable()->index()->after('deal_id');
            $table->foreignId('project_manager_id')->nullable()->index()->after('owner_id');
            $table->string('project_type')->nullable()->after('name');
            $table->string('priority')->nullable()->after('status');
            $table->date('actual_end_date')->nullable()->after('due_date');
            $table->decimal('budget', 15, 2)->nullable()->after('progress');
            $table->decimal('contract_value', 15, 2)->nullable()->after('budget');
            $table->string('billing_type')->nullable()->after('contract_value');
            $table->text('technology_stack')->nullable()->after('billing_type');
            $table->text('scope_of_work')->nullable()->after('technology_stack');
            $table->text('requirements')->nullable()->after('scope_of_work');
            $table->text('deliverables')->nullable()->after('requirements');
            $table->text('risks')->nullable()->after('deliverables');
        });
    }

    public function down(): void
    {
        Schema::table('projects', function (Blueprint $table) {
            $table->dropColumn(['handover_document_id','project_manager_id','project_type','priority','actual_end_date','budget','contract_value','billing_type','technology_stack','scope_of_work','requirements','deliverables','risks']);
        });
    }
};
