<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\LeaveBalance;

class LeaveBalanceSeeder extends Seeder
{
    public function run(): void
    {
        $users = User::all();
        $year = (int)date('Y');

        foreach ($users as $user) {
            LeaveBalance::updateOrCreate(
                ['user_id' => $user->id, 'year' => $year],
                [
                    'annual_total' => 15,
                    'annual_used' => 0,
                    'sick_total' => 10,
                    'sick_used' => 0,
                    'casual_total' => 7,
                    'casual_used' => 0,
                ]
            );
        }
    }
}
