<?php

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::table('projects', function (Blueprint $table) {
            $table->string('category')->nullable()->after('name');
            $table->string('contract_number')->nullable()->unique()->after('category');
            $table->string('ahp_name')->nullable()->after('contract_number')->comment('Affordable Housing Project name');
            $table->string('project_duration')->nullable()->after('ahp_name')->comment('e.g., 12 months');
            $table->decimal('project_sum', 15, 2)->nullable()->after('budget')->comment('Project Sum in KES');
            $table->integer('units')->nullable()->after('project_sum')->comment('Number of units');
            $table->date('commencement_date')->nullable()->after('start_date');
            $table->date('expected_end_date')->nullable()->after('end_date');
            $table->string('ward')->nullable()->after('location');
            $table->string('constituency')->nullable()->after('ward');
            $table->string('county')->nullable()->after('constituency');
            $table->string('contractor')->nullable()->after('client');
            $table->string('consultant')->nullable()->after('contractor');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('projects', function (Blueprint $table) {
            $table->dropColumn([
                'category',
                'contract_number',
                'ahp_name',
                'project_duration',
                'project_sum',
                'units',
                'commencement_date',
                'expected_end_date',
                'ward',
                'constituency',
                'county',
                'contractor',
                'consultant',
            ]);
        });
    }
};
