<?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('treasury_entries', function (Blueprint $table) {
            $table->id();
            $table->foreignId('category_id')->constrained('treasury_categories')->onDelete('cascade');
            $table->string('code', 15)->nullable();
            $table->date('date');
            $table->decimal('amount', 10, 2);
            $table->string('title');
            $table->text('description')->nullable();
            $table->string('attachment')->nullable();
            $table->boolean('is_valid')->default(0);
            $table->datetime('validation_date')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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