<?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('bank_accounts', function (Blueprint $table) {
            $table->id();
            $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete();

            $table->string('main_bank')->nullable();       // col K
            $table->string('branch_bank')->nullable();     // col L
            $table->string('bank_name')->nullable();       // col M
            $table->string('account_type')->nullable();    // col N (empty in source)
            $table->string('account_number', 32)->nullable(); // col O (NUBAN, 10 digits)

            $table->boolean('is_primary')->default(true);
            $table->timestamps();

            $table->index('employee_id');
        });
    }

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