<?php

declare(strict_types=1);

use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Migrations\Migration;

class CreateBarangayBudgetTable extends Migration
{
    public function up(): void
    {
        Schema::create('barangay_budget', function (Blueprint $table) {
            $table->id();
            $table->string('hashkey')->unique()->nullable();
            $table->string('fiscal_year', 4);
            $table->enum('category', ['INCOME', 'EXPENSE']);
            $table->string('source');
            $table->decimal('amount', 15, 2);
            $table->text('description')->nullable();
            $table->date('date')->nullable();
            $table->string('reference')->nullable();
            $table->unsignedBigInteger('encoded_by')->nullable();
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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