<?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('account_payables', function (Blueprint $table) {
            $table->string('invoice_number')->nullable()->after('due_date')->comment('發票號碼');
            $table->date('invoice_date')->nullable()->after('invoice_number')->comment('發票日期');
            
            $table->timestamp('paid_at')->nullable()->after('status')->comment('付款時間');
            $table->string('payment_method')->nullable()->after('paid_at')->comment('付款方式');
            $table->text('payment_note')->nullable()->after('payment_method')->comment('付款備註');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('account_payables', function (Blueprint $table) {
            $table->dropColumn([
                'invoice_number',
                'invoice_date',
                'paid_at',
                'payment_method',
                'payment_note'
            ]);
        });
    }
};
