<?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('cash_mutations', function (Blueprint $table) {
            $table->id();
            $table->decimal('amount', 15, 2);
            $table->date('mutation_date');
            $table->enum('from_account', ['petty', 'cash', 'bank']);
            $table->enum('to_account', ['petty', 'cash', 'bank']);
            $table->text('notes')->nullable();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->timestamps();
        });
    }

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