<?php

namespace Database\Factories\Person;

use App\Enums\PersonPhoneType;
use App\Models\Person\PhoneType;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Person\PersonPhone>
 */
class PersonPhoneFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'nu' => $this->faker->numerify('06########'),
            'type_id' => PhoneType::factory(),
            'user_id' => User::factory(),
            'validated' => $this->faker->boolean(80),
            'phone_type' => PersonPhoneType::Mobile->value,
        ];
    }

    public function mobile(): self
    {
        return $this->state(fn () => ['phone_type' => PersonPhoneType::Mobile->value]);
    }

    public function landline(): self
    {
        return $this->state(fn () => ['phone_type' => PersonPhoneType::Landline->value]);
    }

    public function voip(): self
    {
        return $this->state(fn () => ['phone_type' => PersonPhoneType::Voip->value]);
    }

    public function validated(): self
    {
        return $this->state(fn () => ['validated' => true]);
    }

    public function notValidated(): self
    {
        return $this->state(fn () => ['validated' => false]);
    }
}
