<?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('budget_control', function (Blueprint $table) {
            $table->id();
            $table->foreignId('cabang_id')->nullable()->constrained('cabang');

            $table->foreignId('sender_id')->constrained('admins');
            $table->foreignId('receiver_id')->constrained('admins');

            $table->integer('amount');
            $table->string('remarks')->nullable();

            $table->string('periode_month');
            $table->integer('periode_year');

            $table->timestamp('transferred_at')->nullable();
            $table->timestamp('closing_at')->nullable();

            $table->string('status')->default('Unassigned');

            $table->timestamps();
            $table->softDeletes();
        });
    }

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