<?php

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

/** @extends Factory<User> */
class UserFactory extends Factory
{
    protected $model = User::class;

    public function definition(): array
    {
        return [
            'email' => Str::uuid().'@example.test',
            'password_hash' => Hash::make('password'),
            'first_name' => 'Test',
            'last_name' => 'User',
            'phone' => null,
            'email_verified' => true,
            'role' => 'USER',
            'status' => 'ACTIVE',
            'preferred_currency' => 'USD',
            'language' => 'en',
            'timezone' => 'UTC',
        ];
    }

    public function unverified(): static
    {
        return $this->state(fn (): array => [
            'email_verified' => false,
            'status' => 'PENDING_VERIFICATION',
        ]);
    }
}