<?php

namespace Database\Factories;

use App\Models\SalaryHistory;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class SalaryHistoryFactory extends Factory
{
    protected $model = SalaryHistory::class;

    public function definition(): array
    {
        $old = $this->faker->numberBetween(3000000, 6000000);
        $new = $old + $this->faker->numberBetween(-500000, 1000000);

        return [
            'user_id' => User::factory(),
            'old_salary' => $old,
            'new_salary' => max(0, $new),
            'effective_date' => $this->faker->date(),
        ];
    }
}
