<?php

namespace Database\Factories;

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

/**
 * @extends Factory<User>
 */
class UserFactory extends Factory
{
    public function definition(): array
    {
        return [
            'phone'       => '+255' . fake()->unique()->numerify('7########'),
            'name'        => fake()->name(),
            'role'        => 'rider',
            'is_verified' => true,
            'is_suspended'=> false,
            'is_admin'    => false,
            'trip_credits'=> 0,
            'rating_avg'  => 0,
            'strike_count'=> 0,
            'lang'        => 'sw',
        ];
    }

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

    public function withCredits(int $credits): static
    {
        return $this->state(['trip_credits' => $credits]);
    }

    public function admin(): static
    {
        return $this->state(['is_admin' => true, 'role' => 'both']);
    }

    public function suspended(): static
    {
        return $this->state(['is_suspended' => true]);
    }
}
