<?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::create('utility_fees', function (Blueprint $table) {
            $table->id();
            $table->date('transaction_date')->comment('費用日期');
            $table->string('category')->comment('費用類別 (例如：電費、水費、瓦斯費)');
            $table->decimal('amount', 12, 2)->comment('金額');
            $table->string('invoice_number', 20)->nullable()->comment('發票號碼');
            $table->text('description')->nullable()->comment('說明/備註');
            $table->timestamps();

            // 常用查詢索引
            $table->index(['transaction_date', 'category']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('utility_fees');
    }
};
