<?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('batch_kpi_snapshots', function (Blueprint $table) {
            $table->decimal('realized_revenue_crc', 14, 2)->default(0)->after('total_cost_crc');
            $table->decimal('net_cashflow_crc', 14, 2)->default(0)->after('realized_revenue_crc');
            $table->decimal('roi_pct', 12, 2)->nullable()->after('net_cashflow_crc');
            $table->decimal('projected_roi_pct', 12, 2)->nullable()->after('roi_pct');
        });
    }

    public function down(): void
    {
        Schema::table('batch_kpi_snapshots', function (Blueprint $table) {
            $table->dropColumn([
                'realized_revenue_crc',
                'net_cashflow_crc',
                'roi_pct',
                'projected_roi_pct',
            ]);
        });
    }
};
