<?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('staff_leave_allocations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('staff_id')->constrained('staff')->cascadeOnDelete();
            $table->string('leave_type');
            $table->integer('year');
            $table->decimal('days_allocated', 5, 1)->default(0);
            $table->decimal('days_taken', 5, 1)->default(0);
            $table->decimal('days_balance', 5, 1)->default(0);
            $table->decimal('days_carried_forward', 5, 1)->default(0);
            $table->timestamps();
        });
    }

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