<?php

namespace Database\Seeders;

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

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

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

            return;
        }

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

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