<?php

namespace Database\Factories;

use App\Models\Employee;
use App\Models\PayrollPeriod;
use Illuminate\Database\Eloquent\Factories\Factory;

class PayrollFactory extends Factory
{
    public function definition(): array
    {
        $baseSalary = fake()->numberBetween(1000000, 10000000);
        $bonus = fake()->numberBetween(0, 500000);
        $deduction = fake()->numberBetween(0, 200000);

        return [
            'payroll_period_id' => PayrollPeriod::factory(),
            'employee_id' => Employee::factory(),
            'base_salary' => $baseSalary,
            'bonus_amount' => $bonus,
            'deduction_amount' => $deduction,
            'total_amount' => $baseSalary + $bonus - $deduction,
            'status' => fake()->randomElement(['unpaid', 'paid', 'cancelled']),
            'paid_at' => null,
        ];
    }
}
