<?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('expense_archives', function (Blueprint $table) {
            $table->id();
            $table->string('title_ar');
            $table->string('title_en');
            $table->string('month_key')->index();
            $table->date('settlement_date')->index();
            $table->foreignId('settled_by')->nullable()->constrained('users')->nullOnDelete();
            $table->unsignedBigInteger('total_amount')->default(0);
            $table->unsignedInteger('items_count')->default(0);
            $table->timestamps();
        });
    }

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