<?php

namespace Database\Factories;

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

/**
 * @extends Factory<Employee>
 */
class EmployeeFactory extends Factory
{
    protected $model = Employee::class;

    protected static int $seq = 1;

    public function definition(): array
    {
        $n = static::$seq++;

        return [
            'emp_id' => sprintf('EMP%04d', 9000 + $n),
            'name' => fake()->name(),
            'active' => true,
            'consent_on' => now()->subDays(10)->toDateString(),
        ];
    }

    public function withoutConsent(): static
    {
        return $this->state(fn (array $attributes) => ['consent_on' => null]);
    }

    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => ['active' => false]);
    }
}
