<?php

namespace Database\Factories;

use App\Enums\EmploymentStatus;
use App\Enums\Gender;
use App\Models\Employee;
use Illuminate\Database\Eloquent\Factories\Factory;

class EmployeeFactory extends Factory
{
    public function definition(): array
    {
        return [
            'full_name' => $this->faker->name(),
            'code' => Employee::generateEmployeeCode(),
            'phone_number' => fake()->randomElement([
                fake()->numerify('0812 #### ###'),
                fake()->numerify('0812 #### ####'),
                fake()->numerify('0812 #### #####'),
            ]),
            'base_salary' => $this->faker->randomNumber(6),
            'gender' => $this->faker->randomElement(Gender::cases()),
            'address' => $this->faker->address(),
            'birthdate' => $this->faker->dateTimeBetween('-60 years', '-18 years')->format('Y-m-d'),
            'hire_date' => $this->faker->date(),
            'resign_date' => $this->faker->optional()->date(),
            'status' => $this->faker->randomElement(EmploymentStatus::cases()),
        ];
    }
}
