<?php

namespace Database\Factories\Person;

use App\Models\Person\PersonGroup;
use App\Models\Person\PersonType;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Person\Person>
 */
class PersonFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'first_name' => $this->faker->firstName(),
            'last_name' => $this->faker->lastName(),
            'full_name' => fn (array $attrs) => trim(($attrs['first_name'] ?? '').' '.($attrs['last_name'] ?? '')),
            'gender' => $this->faker->randomElement(['m', 'w']),
            'birthday' => $this->faker->optional()->date(),
            'tax_number' => $this->faker->optional()->bothify('########'),
            'social_security_number' => $this->faker->optional()->bothify('#########'),
            'description' => $this->faker->optional()->sentence(),
            'group_id' => PersonGroup::factory(),
            'type_id' => PersonType::factory(),
            'user_id' => User::factory(),
        ];
    }
}
