<?php

namespace Database\Seeders;

use App\Models\Attendance;
use App\Models\Employee;
use Illuminate\Database\Seeder;

class AttendanceSeeder extends Seeder
{
    public function run(): void
    {
        $employees = Employee::query()->limit(3)->get();

        if ($employees->isEmpty()) {
            Attendance::factory()->count(5)->create();

            return;
        }

        foreach ($employees as $employee) {
            Attendance::factory()
                ->count(3)
                ->create([
                    'employee_id' => $employee->id,
                ]);
        }
    }
}
