<?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::create('financial_ledgers', function (Blueprint $table) {
            $table->id();
            $table->timestamp('transaction_date'); // Waktu uang masuk/keluar
            $table->string('reference_code'); // Kode Booking Kos atau Kode Invoice Kuota
            $table->enum('type', ['in', 'out']); // 'in' (Masuk), 'out' (Keluar)
            $table->string('category'); // booking_fee, refund_tenant, quota_purchase
            $table->unsignedBigInteger('amount'); // Nominal uang (Rp)
            $table->text('description')->nullable(); // Keterangan detail
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('financial_ledgers');
    }
};
