<?php

namespace Database\Factories;

use App\Enums\UserRole;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

/**
 * جایگزین UserFactory پیش‌فرض Laravel — تطبیق‌یافته با ستون‌های واقعی این پروژه
 * (mobile به‌جای email برای ورود، role اجباری).
 */
class UserFactory extends Factory
{
    public function definition(): array
    {
        return [
            'first_name' => fake()->firstName(),
            'last_name' => fake()->lastName(),
            'mobile' => '09'.fake()->numerify('#########'),
            'email' => fake()->unique()->safeEmail(),
            'password' => Hash::make('Password@123'),
            'role' => UserRole::Athlete,
            'is_active' => true,
        ];
    }

    public function admin(): static
    {
        return $this->state(fn () => ['role' => UserRole::Admin]);
    }

    public function coach(): static
    {
        return $this->state(fn () => ['role' => UserRole::Coach]);
    }

    public function athlete(): static
    {
        return $this->state(fn () => ['role' => UserRole::Athlete]);
    }
}
