<?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('invoices', function (Blueprint $table) {
            $table->decimal('down_payment', 15, 2)->default(0)->after('remaining_balance');
            $table->decimal('cash_payment', 15, 2)->default(0)->after('down_payment');
            $table->decimal('card_payment', 15, 2)->default(0)->after('cash_payment');
            $table->text('card_info')->nullable()->after('card_payment');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('invoices', function (Blueprint $table) {
            $table->dropColumn(['down_payment', 'cash_payment', 'card_payment', 'card_info']);
        });
    }
};
