<?php

namespace Database\Seeders;

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

class LeaveRequestSeeder extends Seeder
{
    public function run(): void
    {
        $employee = Employee::query()->first();

        if ($employee === null) {
            LeaveRequest::factory()->count(3)->create();

            return;
        }

        LeaveRequest::factory()->count(2)->create([
            'employee_id' => $employee->id,
        ]);

        LeaveRequest::factory()->approved()->create([
            'employee_id' => $employee->id,
        ]);
    }
}
